I understand that the order of columns in the index itself matters immensely; however, what about the order of columns in the subsequent SELECT queries that make use of that index?
For example, if I have a multi-column index on [:col_1, :col_2, :col_3]
, does my SELECT statement need to look like "SELECT * FROM my_table WHERE col_1 = (?), col_2 = (?), col_3 = (?)"
in order for the query to be optimized? Or can I specify the params in any order and the query optimizer will handle it?
I've read a few similar answers, but there didn't seem to be a definitive answer that pointed to documentation, and answered relative to indexes. Some answers say "it shouldn't matter" or "effect is negligible".
I'm working with RoR/ActiveRecord on PostgreSQL, but the question is really for any SQL/relational DB.