39
loading...
This website collects cookies to deliver better user experience
explain(verbose)
of it:(customer_id, (extract(dow from order_date)))
to get fast access to those rows. To change it to a covering index, it is not sufficient to add include (order_amount)
as I did above. We use the PostgreSQL query planner that doesn’t analyze — at optimization time — which columns are used in the expression. Then, if you want the expression to be covered, you need to add all columns that are used by the function. Here is the index that covers the query:order_date
added, an Index Scan would have been executed even if not required to get the result.