News for hackers. Stuff that matters.
Re:How a SQL database works by brazzy on Thursday December 19, 2019 @04:05PM (#21839292)
Nice. Now explain query optimizers.
Re:How a SQL database works by calpaterson on Friday December 20, 2019 @06:28AM (#21843318)
I'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.
Re:How a SQL database works by brazzy on Friday December 20, 2019 @12:17PM (#21845697)
Grace hash join would be another major topic to cover first.
Re:How a SQL database works by barrkel on Thursday December 19, 2019 @04:10PM (#21839343)
Almost 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.