Postgresql – Postgres Query Optimization for Percentiles of Sales by Region
I'm computing some percentile sales data grouped by product / US state, and the query is extremely slow for a large list of locations (see "dma" in [long list of locations]). The table is around ~15 million rows. SELECT 'us_state'…