Earlier quoted context omitted.
SQL is a declarative language: You describe what you want , not how to get it. If that's not what you need, there are plenty of procedural languages whith which you describe how to get things . A query plan will change based on statistics. It's the engine's job to decide if your query is best served by parallelizing it to multiple cores, or deciding if it's worth JITing it before execution. The actual execution of th…
"You describe what you want, not how to get it." The entire archive of the pgsql users' mailing list disagrees. Every wants to know why their plan is suboptimal, or why it changed. People also want to know why the planner takes 100ms to generate the plan and only 1ms to execute the query, and so forth. The idea that you just say what you want and you get the optimal result from your database is just ridiculous to any…
However, database engines aren't perfect -- I know I've encountered bugs in older SQL server versions where the query never finishes but making some trivial adjustments fixes it. This is a bug. And most mailing lists are filled with people encountering bugs. Saying what you want and getting the best result is exactly what you should expect.