I have a query that uses a compound index like (customer_id, is_premium). The index advisor wants me to add an index for customer_id but Postgres is using the compoound index (as confirmed by EXPLAIN) and note that the docs say:
A multicolumn B-tree index can be used with query conditions that involve any subset of the index's columns, but the index is most efficient when there are constraints on the leading (leftmost) column
https://www.postgresql.org/docs/current/indexes-multicolumn.html
I have a query that uses a compound index like
(customer_id, is_premium). The index advisor wants me to add an index forcustomer_idbut Postgres is using the compoound index (as confirmed by EXPLAIN) and note that the docs say:https://www.postgresql.org/docs/current/indexes-multicolumn.html