Why does nestloop win?

A question came up during part of my OSCON presentation about why the nestloop operator is chosen, if hashjoin, mergejoin, and nestloop were all set as "disabled." The reason is that there is some additional logic in the code (joinpath.c to be precise) over and beyond the cost += 100,000,000 trick. This logic looks at whether or not hashjoin and mergejoin have been disabled (independent of the cost boosting) as far as picking out which join to use. The cost boosting effect is still kept, however, as there are still cases where those joins must be used, even if they are requested to be disabled.

In most cases, however, they are "doubly discouraged" by the cost boosting and the logic in joinpath.c.

Return to Optimizer example page.