In a multi-column index, I know that the order matters regarding which types of queries will be able to use the index. The columns mentioned in WHERE should be the leftmost columns in the index. Here's a Postgres article about that.
But, consider the case where all columns are used. Does the order affect performance of using the index in these two scenarios:
- queries with multiple
=. example:SELECT * FROM "posts" WHERE "user_id" = 5 AND "post_type" = 'Thing' AND "state" = 'active' - in queries involving an
IN. example:SELECT * FROM "posts" WHERE "user_id" = 5 AND "post_type" = 'Thing' AND ("state" IN ('active', 'draft'))