2 ms·
"will find that the database is the inevitable bottleneck that can't simply be scaled by putting machines in parallel" In context, the alternatives available a
by jeffdavis 13y ago
"will find that the database is the inevitable bottleneck that can't simply be scaled by putting machines in parallel"
In context, the alternatives available are something like:
1. Issue one recursive query
2. Issue many non-recursive queries
3. Use some kind of denormalized structure that is tuned to the one specific recursive query in question, but might perform badly on other queries.
#3 can work if you are focusing on the optimization of a single query and can pick a structure tuned to that one query. You can even parallelize it, because you can know the partitioning scheme that will work best for that one query. But outside of those constraints, or if the query profile changes over time, it does not work well. You end up needing to duplicate the data into many different structures to accommodate many different queries.
And I don't see how #2 has any advantage over #1 performance wise. Add caching layers or other performance hacks as needed.
- btilly 13y agoFor further context, I'm responding to someone who is advocating putting your business layer in your database. I'm not against using tools that exist to make accessing your database more efficient - including recursive queries. I'm against making your database responsible for more of your application than it needs to be.