This commit is contained in:
2018-10-05 20:11:10 +00:00
parent 11fe7dce59
commit f6c9280a11
3 changed files with 17 additions and 6 deletions

View File

@@ -6,6 +6,15 @@ http://okigiveup.net/what-postgresql-tells-you-about-its-performance/
Useful queries to indicate how indexes are being used in postgresql
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
OK: this is the best query to use to find non used indexes
Run it and look for any indexes that are *not* primary keys (name ends in pkey, want ones that end in idx which are mine)
that have zero in idx_scan, that means they are completely unused (if a lot of full test runs that excercise all routes and features have happened prior to checking)
SELECT * FROM pg_stat_user_indexes order by idx_scan asc
Following queries might be useful but for different purposes...
This is a test query I used with widget and name fetching performance analysis:
explain analyze SELECT m.name