EXPLAIN ANALYZE or EXPLAIN (ANALYZE, BUFFERS)?
UPDATE 2025: Starting with Postgres 18, the `BUFFERS` option becomes default in `EXPLAIN ANALYZE`, which is great news.
UPDATE 2025: Starting with Postgres 18, the `BUFFERS` option becomes default in `EXPLAIN ANALYZE`, which is great news.
Benchmarking is a huge topic. Here, we cover minimal steps that are required for a Postgres benchmark to be informative, useful, and correct.
Detect, measure, and eliminate table and index bloat to maintain database health
Identify and handle long-running transactions that can impact OLTP system performance
"Slow" is a relative concept. In some cases, we might be happy with query latency 1 minute (or no?), while in other scenarios, even 1 ms might seem to be too…
In a few hours, I'm presenting my "Seamless Postgres query optimization" tutorial at DjangoCon US, so it's a good time to talk about transitioning from…
reach FP_LOCK_SLOTS_PER_BACKEND=16 relations (both tables and indexes) involved in query processing, which, under high QPS, increases chances of having…
For experiments, it is important to take into account the state of caches – Postgres buffer pool (size of which is controlled by shared_buffers) and OS page…
Modern Postgres provides more than 300 settings (a.k.a. GUC variables – "grand unified configuration").
In a fast-growing project, one of the important optimization vectors is reduction of the amount of WAL (Write Ahead Log) generated.
Learn how to how to run analyze (to collect statistics)
If you need to load a lot of data, here are the tips that can help you do it faster.
After a series of rather hefty posts, let's take a breather with some lighter material.
Today we'll discuss how to understand what exactly a Postgres backend is doing inside CPU on a Linux machine (in-CPU analysis).
work_mem is used for sorting and hashing operations during query execution.
Understand subtransactions, savepoints, and their impact on database performance
There are two big branches of query optimization:
Index maintenance is inevitable in a larger project. The sooner the process is established the better for performance.
Everyone knows that each additional index is going to slow down writes (INSERT, UPDATE – unless it's HOT).
The 80/20 rule (a.k.a. Pareto principle) is often enough to achieve a good level of performance for OLTP workloads – it is recommended, in most cases, to…