4 ms·
Nice. Now explain query optimizers.
by brazzy 7y ago
Nice. Now explain query optimizers.
- barrkel 7y agoAlmost everything is down to join order, and that's mostly down to which join order ends up with the fewest rows to process. MySQL IMHO is better for this than Postgres because it's more predictable and you have more tools to force its behaviour, with straight_join and index hints, whereas with Postgres you're forced to use CTEs to control evaluation behaviour when you have application knowledge that the DB doesn't have stats for. If you know nothing about how databases work, and deal in mostly simple queries, Postgres is a better choice though.
- calpaterson 7y agoI'll try! :) I wanted to cover this material because I found that most of the "how SQL works" intros discuss query planning but I think knowing the underlying datastructures gives people pretty useful intuition.
- brazzy 7y agoGrace hash join would be another major topic to cover first.