From the course: Advanced SQL for Query Tuning and Performance Optimization
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
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
-
-
-
-
-
-
-
-
-
(Locked)
Collect statistics about data in tables3m 21s
-
(Locked)
Analyzing execution statistics with pg_stat_statements1m 54s
-
(Locked)
Reviewing execution plans with the auto_explain module2m 34s
-
(Locked)
Additional analysis with other pg_stats data1m 26s
-
(Locked)
Challenge: Analyze schema statistics23s
-
(Locked)
Solution: Analyze schema statistics16s
-
(Locked)
-
-