66 ms·
Agreed - I think SQL is great, but the JOIN operator has been problematic for me with analytic queries and queries where you want to enrich data across differen
by mattxxx 3y ago
Agreed - I think SQL is great, but the JOIN operator has been problematic for me with analytic queries and queries where you want to enrich data across different tables.
I think the problem is fundamentally that if you take a record, and split it across 2 tables, then there's no easy operation to merge them and guarantee distinctness.
Separately, even though there are some %-breakdowns in the article, I don't think the `DISTINCT` sort is so much of a problem in most cases. Usually the actually joining is the problem for any truly large dataset, so while I trust the diagrams shown, I think those %'s change dramatically based on the underlying data.
- marcosdumay 3y ago> I don't think the `DISTINCT` sort is so much of a problem in most cases I train people new to SQL at work, and I can tell you with complete certainty that you only get this impression because people learn very quickly to never use `distinct`. It's by far the most common cause of performance problems for people new to SQL.
- sgarland 3y agoImagine you’re a SaaS company with millions of customers. Each of those customers will have tens or hundreds of recorded payments (orders). Even if you scale down on customers by two orders of magnitude, the intermediate table starts growing rapidly.