|
|
|
|
|
by silon7
3972 days ago
|
|
I want my queries to always behave the same and fail without an index. (you can't have a reliable system with random behavior where system drops to table scans when statistics are incomplete or something) And yes, ordering requires an index. |
|
In PostgreSQL if you want to know what indices are used by a query, just ask the system using an EXPLAIN ANALYZE query and if it does not use any indices, create them (or live with the performance).
Also there are "Index-only scans" which I do not know much about but may well fit your approach: https://wiki.postgresql.org/wiki/Index-only_scans
So to summarize: automatic index selection is not random and slow queries can be identified pretty easy.