Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
shazzdeeds
· 4y ago · 0 comments
This is effectively what CTE style syntax gives you. I always find them more intuitive for intermediate to advanced queries for exactly this reason. They’re also much easier for another reader to later come in and deduce what the query is doing.
Comments
[–]
jansommer
4y ago
CTE's are indeed nice, but can also make your queries substantially slower, at least in Postgres
[–]
DangitBobby
4y ago
That's mainly true because you don't have the benefit of an index when you join on a CTE, isn't it?
[–]
jansommer
4y ago
It'a slow even without indexes. In other cases, where the CTE is used multiple times in the same query, it can be faster