|
|
|
|
|
by joenot443
698 days ago
|
|
That's a well written article. For developers newer to relational databases, there's a heuristic at the beginning which I remember hearing elsewhere and keeping it in mind when I'm doing query work. "You might expect that many small queries would be fast and one large, complex query will be slow. This is rarely the case. In practice, the opposite is true." |
|
A big part of why it works out that way is that the query planner can only optimize for the query you give it. If you give it a bunch of small queries, it can only make relatively inconsequential micro-optimizations. The one big query gives it a lot more degrees of freedom and opportunities to make big gains.
Here's another great resource for getting more out of relational databases: https://use-the-index-luke.com/