6 ms·
Current databases don't give the developer a way to bypass the optimizer. Sure they do. Oracle and other commercial DBs provide "planner hints", which essentia
by neilc 18y ago
Current databases don't give the developer a way to bypass the optimizer.
Sure they do. Oracle and other commercial DBs provide "planner hints", which essentially force the optimizer to use a particular access method / join method for a given part of the plan.
why does SQL decide that declarative style is the One True Way to get access to your data
Well, part of the reason for a query optimizer is that if the physical representation of the data changes, the queries don't need to change. So that if you add or remove an index, you don't need to adjust all the queries on the table, for example. Obviously the query planner is imperfect, but planner hints are fairly common in practice. The further you stray from declarative queries, the more application changes are needed when physical database properties change.
Datatypes don't match your PL
If you want a strongly-typed database system that can be accessed from any language, you need the DB's type system to be distinct from any of the client language's type systems. This isn't always the right tradeoff, of course.
- arohner 18y agopart of the reason for a query optimizer is that if the physical representation of the data changes, the queries don't need to change. And that's a great reason to use the declarative query as the default. What I'm complaining about is when you need to eek out the last bit of performance out of a query, there should be another option. Sort of like dropping into assembly to optimize a tight loop. Of course you don't want to write the entire program in assembly. you need the DB's type system to be distinct from any of the client language's type systems. I don't agree. Just because your DB's type system uses say, Java, doesn't mean that other languages can't access the DB. Non-Java languages would access the DB the same way they do today, but at least the Java developers wouldn't have to convert.