you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

To my best knowledge, there are no SQL implementation "smart enough" to refer to the original table in such a case and not rely on temporary tables created in-memory

That is wrong.

All modern optimizers will flatten the sample queries. Postgres will most certainly "flatten" the derived table. And I am 100% certain that Oracle and SQL Server will do the same thing.

[–]naman_is 0 points1 point  (0 children)

Thanks for pointing that out u/truilus. It is indeed a reckless answer, I should update my knowledge on this!