Postgresql – Optimize a query using multicolumn indices
Say you want to optimize a query in a postgres database like: SELECT DISTINCT ON (first) first, second, third FROM my_table WHERE second > 100 AND fourth = 3 ORDER BY first, second DESC, third DESC (EDIT: In this example,…