Given a query, how do you know which indices to add? Given a query, how do you know which indices to add? database database

Given a query, how do you know which indices to add?


You need data in tables.

Then you may use EXPLAIN ANALYZE

http://www.postgresql.org/docs/9.0/interactive/using-explain.html

You may add and drop indexes and compare times.