Super fast aggregations in PostgreSQL 19
11 points by sjamaan
11 points by sjamaan
You can get the new query plan on older databases by doing something like
SELECT category_name, color_name, products
FROM (SELECT category_id, color_id, count(*) AS products
FROM t_product
GROUP BY 1, 2) AS p
JOIN t_category USING (category_id)
JOIN t_color USING (color_id);
(assuming your category/color names are unique) but it'll be nice to have better performance with naìˆve queries.