SShortSingh.
Back to feed

Why Large Postgres UPDATE Queries Stall Deployments and How to Fix Them

0
·1 views

Running a bulk UPDATE on a large production Postgres table can silently lock the database, stall deployments, and provide no progress feedback until the query finishes or is forcibly terminated. The problem is common during migrations that appear instant on small datasets but become unmanageable at scale, sometimes affecting hundreds of millions of rows. Common chunking strategies — such as splitting by business columns, using OFFSET/LIMIT pagination, or computing buckets with window functions like NTILE — each carry hidden costs, including full table scans before a single row is processed. OFFSET-based approaches are particularly deceptive, as they degrade in performance at large offsets and can cause rows to be skipped or double-processed if the table changes mid-migration. The recommended approach is to break the work into small, independently safe chunks using primary key ranges, minimizing lock duration and allowing failures to be recovered without restarting the entire operation.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Research Lab Repels LLM-Driven Cyberattack by Turning the AI Against Itself

A research lab reported being targeted by a cyberattack built around a large language model, marking a notable shift from theoretical AI security research to a real-world incident. Rather than simply blocking the attack, the lab claims it reversed the AI's methods and used them against the attacker. Security analysts note that while AI-versus-AI offense-defense loops are not structurally new, the key development is an LLM autonomously adapting its attack strategy in real time based on target responses. Critics caution that framing the incident around the model's national origin obscures more important questions about how the LLM was weaponized and what defensive techniques actually worked. Security teams are advised to log all API activity, rate-limit aggressively, and avoid exposing error details that an adaptive, LLM-driven attacker could use to refine subsequent attempts.

0
ProgrammingDEV Community ·

Developer Builds AI Social Media Tool 'Bleam' With Free Scheduling and Paid Content Generation

A former Jakarta agency founder is developing an AI-powered social media tool called Bleam, designed to automate content creation, scheduling, and DM responses for small businesses and agencies. The platform offers free scheduling across Instagram, TikTok, and Google Business Profile, along with basic caption generation and an Instagram audit tool requiring no signup. Paid features include full monthly content generation, comment-to-DM automation, multiple workspaces, and white labeling, primarily targeting agencies managing several client accounts. The developer explained that scheduling is free because platforms like Meta already offer it at no cost, while content generation sits behind a paywall because AI inference carries a real per-user cost. The tool is currently pre-launch with no live users, and the founder acknowledged uncertainty about whether the free tier is compelling enough to drive organic growth.

0
ProgrammingDEV Community ·

AWS Kiro Promotes Spec Coding to Address Gaps Left by AI Vibe Coding

Vibe coding, a development style where software is built through conversational AI prompts, has gained popularity for rapidly turning ideas into working applications. However, as projects scale, developers face growing challenges maintaining coherence, context, and architectural consistency across the codebase. AWS Kiro introduces a contrasting approach called Spec Coding, which requires AI to first define requirements, design, and intent before generating any code. This specification-driven workflow keeps structured documentation alongside the codebase, reducing the need to reconstruct project context with every new prompt. The approach aims to make AI act more like a software engineer than a code generator, particularly for production-grade systems.

0
ProgrammingDEV Community ·

How the Plan-Act-Observe Loop Powers AI Agents in Software Development

AI agents are autonomous programs that use artificial intelligence to perform tasks such as code reviews, debugging, and optimization without constant human input. At their core, these agents operate on a plan-act-observe loop, a three-stage cycle in which the agent first determines what action to take, then executes it, and finally evaluates the outcome to refine its next move. This iterative feedback mechanism allows AI agents to continuously improve their responses based on real-time results. Developers can build such agents using cloud tools like AWS Lambda combined with relevant SDKs to automate repetitive coding workflows. The approach represents a growing shift in software development toward AI-assisted automation of routine engineering tasks.