Member-only story
How to track statistics on all queries in your Postgres database to prevent slow queries or bottlenecks
Tweak your database performance to perfection with the crucial statistics that this extensions offers you
Have you ever wondered why some parts of your application are suddenly very slow? Can it be your database? How would you find out? Wouldn’t it be nice to have an extensions that tracks statistics over all queries that it executes so that you can analyze your database performance and clear up bottlenecks?
In this article we’ll look at a Postgres extension called pg_stat_statements. It keeps statistics on all queries that your database executes and thusly offers crucial information on the performance of your database. With it, you can easily track the performance of your database, detect slow queries, eliminate bottlenecks and prevent problems from happening.
We’ll first go through the very simple installation. Then we demo how to use it. Let’s code!
What does this extension do?
Pg_stat_statements is an extension of Postgres that tracks execution statistics of all queries executed by a server. This extensions keeps track of statics like
- number of times the…