From the course: Advanced SQL for Query Tuning and Performance Optimization

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Analyzing execution statistics with pg_stat_statements

Analyzing execution statistics with pg_stat_statements - SQL Tutorial

From the course: Advanced SQL for Query Tuning and Performance Optimization

Analyzing execution statistics with pg_stat_statements

- [Instructor] Postgres has a feature known as pg_stat_statements, and it's a feature for tracking, planning, and execution statistics of all the SQL statements that a server executes. Now, pg_stat_statements, basically, it needs to be turned on. It does take some overhead, so it's off by default, but we can actually turn it on by adding a pg_stat_statements to the shared_preload_libraries section in the Postgres configuration file. Now, this is something that requires a database administrator. It's not something that an average user should do, which is understandable. This is something that affects the entire server, so this may be something you need to work with your DBA on, and not something you could necessarily do yourself unless you do have database administration privileges. Now, pg_stat_statements, the view includes a variety of information. It includes information on, like, the user, the database, and the…

Contents