neondatabase / website

Official docs and website for Neon.
https://neon.tech
190 stars 97 forks source link

Chapter "Use joins instead of subqueries" is probably not what was intended with the chapter #1585

Closed Bodobolero closed 6 months ago

Bodobolero commented 6 months ago

https://github.com/neondatabase/website/blob/d2a0779403d7116a1bc4950f63ec21a7ee8c82d4/content/docs/postgres/query-performance.md?plain=1#L293

Hi, I think I originally am responsible for why this chapter has been created, see https://neondb.slack.com/archives/C03QLRH7PPD/p1705330913629919?thread_ts=1705329575.578679&cid=C03QLRH7PPD where I asked "avoid round-trips and use joins (do not issue multiple SQL transactions / round-trips for a single end-user request - instead use joins where possible and useful)"

I think this could have been misunderstood as "do not use subqueries but use joins".

What I really meant is this:

Joins in prisma

https://github.com/prisma/prisma/discussions/12715 https://github.com/prisma/prisma/issues/5184

Some ORms do many individual queries (many roundtrips) where a single join would suffice.

danieltprice commented 6 months ago

Lots of general advice about using joins instead of subqueries, but we probably need a fuller topic. We'll revisit later. For now, we'll remove the section: https://github.com/neondatabase/website/pull/1586