4 ms·
One thing he may be referring to is a cost-based optimizer (CBO). Dismissing the significance of a CBO is a mistake. For one thing, it's not an optimizer like
by jeffdavis 14y ago
One thing he may be referring to is a cost-based optimizer (CBO). Dismissing the significance of a CBO is a mistake.
For one thing, it's not an optimizer like gcc at all. It doesn't take your existing algorithm and speed it up, it chooses a better algorithm. How does it know which is better? It collects statistics and runs them through a cost model.
This is what allows something like PostgreSQL to offer nested loop joins, merge joins, and hash joins. Without a CBO, how would it know which to choose? Similarly, it can offer multiple ways to use the same index (normal index scan, bitmap index scan) and multiple ways to aggregate (Sort+Group or HashAggregate).
Those are just a few of the many algorithms postgres offers that are chosen in a principled way by the CBO.