Difference between revisions of "Index (PostgreSQL)"

From wikieduonline
Jump to navigation Jump to search
Line 13: Line 13:
  
 
Ref: https://www.craigkerstiens.com/2012/10/01/understanding-postgres-performance/
 
Ref: https://www.craigkerstiens.com/2012/10/01/understanding-postgres-performance/
 +
 +
 +
relname | percent_of_times_index_used | rows_in_table
 +
---------+-----------------------------+---------------
 +
(0 rows)
  
 
== See also ==
 
== See also ==

Revision as of 08:51, 10 August 2021


SELECT 
  relname, 
  100 * idx_scan / (seq_scan + idx_scan) percent_of_times_index_used, 
  n_live_tup rows_in_table
FROM 
  pg_stat_user_tables
WHERE 
    seq_scan + idx_scan > 0 
ORDER BY 
  n_live_tup DESC;

Ref: https://www.craigkerstiens.com/2012/10/01/understanding-postgres-performance/


relname | percent_of_times_index_used | rows_in_table
---------+-----------------------------+---------------
(0 rows)

See also

Advertising: