You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by Apache Wiki <wi...@apache.org> on 2006/11/07 23:52:58 UTC
[Db-derby Wiki] Trivial Update of "LanguageOptimize" by Army
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.
The following page has been changed by Army:
http://wiki.apache.org/db-derby/LanguageOptimize
------------------------------------------------------------------------------
All of that said, there are three primary methods in !OptimizerImpl that encapsulate the general process of trying to find the "best join order" for a given !OptimizerImpl's list of Optimizables. These three methods, along with the ways in which they interact, are perhaps most easily summarized by the following code in !SelectNode.optimize():
{{{
- /* Optimize this SelectNode */
+ /* Optimize this SelectNode */
- while (optimizer.getNextPermutation())
+ while (optimizer.getNextPermutation())
- {
+ {
- while (optimizer.getNextDecoratedPermutation())
+ while (optimizer.getNextDecoratedPermutation())
- {
+ {
- optimizer.costPermutation();
+ optimizer.costPermutation();
- }
- }
+ }
+ }
}}}
Note that by the time we get to this code, "optimizer" is an instance of !OptimizerImpl whose list of Optimizables is the FROM list for the !SelectNode, and whose list of predicates corresponds to the !SelectNode's WHERE clause. Note also that !SelectNode is not the only place where we find this kind of loop; we find a similar loop in !TableOperatorNode.