Query generation for cpk_in_predicate now constructs queries in the form:
SELECT *
FROM table_name
WHERE low_cardinality_key_part = 1 AND high_cardinality_part IN (1, 2)
It used to generate queries in the form:
SELECT *
FROM table_name
WHERE
(low_cardinality_key_part = 1 AND high_cardinality_part = 1)
OR (low_cardinality_key_part = 1 AND high_cardinality_part = 2)
This change improves the queries by reducing the overall length of the query, especially when loading many keys. But more importantly the new query will often result in Postgres performing an Index Scan instead of a Bitmap Heap Scan (assuming the right indices have been added).
Query generation for cpk_in_predicate now constructs queries in the form:
It used to generate queries in the form:
This change improves the queries by reducing the overall length of the query, especially when loading many keys. But more importantly the new query will often result in Postgres performing an
Index Scan
instead of aBitmap Heap Scan
(assuming the right indices have been added).