Closed myguidingstar closed 5 years ago
replace currently generated queries like:
(SELECT ("cow"."color") AS "cow/color", ("cow"."index") AS "cow/index" FROM "cow" WHERE (("cow"."index")=(10)) LIMIT 5)
UNION ALL
(SELECT ("cow"."color") AS "cow/color", ("cow"."index") AS "cow/index" FROM "cow" WHERE (("cow"."index")=(20)) LIMIT 5)
with:
WITH walkable_common_join AS (
SELECT ("cow"."color") AS "cow/color", ("cow"."index") AS "cow/index" FROM "cow"
)
(SELECT * FROM walkable_common_join WHERE (("cow/index")=(10)) LIMIT 5)
UNION ALL
(SELECT * FROM walkable_common_join WHERE (("cow/index")=(20)) LIMIT 5)
The use of CTEs should be optional, or even configurable for each join keyword because:
eg make use of
with
for subselects in N+1 queries