NikolayS / postgres_dba

The missing set of useful tools for Postgres DBAs and all engineers
BSD 3-Clause "New" or "Revised" License
1.03k stars 113 forks source link

ERROR: relation "pg_stat_statements" does not exist #34

Closed wolandec closed 5 years ago

wolandec commented 5 years ago

psql 10, Postgresql 10


Press <Enter> to continue…
Menu:
   0 – Node & Current DB Information: master/replica, lag, DB size, tmp files, etc
   1 – Databases: Size, Statistics
   2 – Table Sizes
   3 – Load Profile
  a1 – Current Activity: count of current connections grouped by database, user name, state
  b1 – Tables Bloat, rough estimation
  b2 – B-tree Indexes Bloat, rough estimation
  b3 – Tables Bloat, more precise (requires pgstattuple extension; expensive)
  b4 – B-tree Indexes Bloat, more precise (requires pgstattuple extension; expensive)
  b5 – Tables and Columns Without Stats (so bloat cannot be estimated)
  e1 – List of extensions installed in the current DB
  i1 – Unused/Rarely Used Indexes
  i2 – Unused/Redundant Indexes Do & Undo Migration DDL
  i3 – FKs with Missing/Bad Indexes
  p1 – [EXPERIMENTAL] Alignment Padding. How many bytes can be saved if columns are ordered better?
  s1 – Slowest Queries, by Total Time (requires pg_stat_statements extension)
  s2 – Slowest Queries Report (requires pg_stat_statements)
  t1 – Postgres parameters tuning
  v1 – Vacuum: Current Activity
   q – Quit

Type your choice and press <Enter>:
s1
psql.bin:/home/Develop/postgres_dba/sql/s1_pg_stat_statements_top_total.sql:42: ERROR:  relation "pg_stat_statements" does not exist
LINE 25: from pg_stat_statements
NikolayS commented 5 years ago

Hi @wolandec!

you need to install pg_stat_statements in that database:

create extension pg_stat_statements;

I'm still thinking about the way to have a better reporting about this here.