Postgres Distinct On

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 https://rubyonrails.ba/single/postgres-distinct-on

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles