No Picture
PostgreSQL Performance

How to gather statistics of PostgreSQL only when stale?

In PostgreSQL, you can gather statistics only when they become stale by using the pg_stat_statements extension along with the track_activity_query_size configuration parameter. Follow these steps to achieve this: CREATE EXTENSION pg_stat_statements; 3. Query the pg_stat_statements […]
No Picture
PostgreSQL Performance

Troubleshooting PostgreSQL Query Performance

Monitoring query latency, wait events, and locks in PostgreSQL helps identify and diagnose performance bottlenecks. Here’s a guide on how to monitor these aspects: Here’s a sample query to gather information about locks, wait events, […]
No Picture

Monitoring the load on a PostgreSQL Server

PostgreSQL Load Monitoring To monitor load on a PostgreSQL with details like source, query, latency, count, CPU usage, memory usage, disk reads, and disk writes, you can use the following SQL script: SELECTCOALESCE(application_name, ‘<unknown>’) AS […]
No Picture
PostgreSQL Internals

PostgreSQL Locks, Latches, Enqueues and Mutex

PostgreSQL can be tuned for concurrency and performance by adjusting various configuration parameters that affect the behavior of the database system. Here are some recommended steps for tuning PostgreSQL for concurrency and performance: How to […]
No Picture
PostgreSQL Internals

What does a COMMIT do internally to PostgreSQL?

In PostgreSQL, a COMMIT statement is used to finalize a transaction and make its changes permanent in the database. When a COMMIT statement is executed, the following things happen internally in PostgreSQL: After a transaction […]