Postgres Distinct On
07-May-2020 2284
By day, I am a mild mannered owner/programmer at Box Out Sports. By no means do you need to understand all that we do there or how we do it, but recently I fixed a tricky N 1 query and thought I should write it up.The need arises when you have a parent child relationship and you need the first child matching some criteria. Simple enough. The tricky part is when you want to bulk load a single child for several parents to avoid an N 1 query.
Postgres Distinct On #ruby #rubydeveloper #rubyonrails #Postgres #Distinct https://rubyonrails.ba/link/postgres-distinct-on