News for hackers. Stuff that matters.
Re:PRQL, Pipelined Relational Query Language by hn_throwaway_99 on Wednesday July 26, 2023 @03:17AM (#36874114)
Completely agree, thanks for putting it better than I could have, with an excellent example. Correlated subqueries like the example you give, or similarly lateral joins in postgres, fundamentally are treated like for loops by DB engines anyway.

Semi-related, but the example you give is also why I love Postgres' "DISTINCT ON" functionality (I don't know if other DBs have something similar) - it makes it so much easier to reason about these "give me the 'first' one from each group" type queries without having to resort to correlated subqueries.

There are no comments on this comment yet.