db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendleton.de...@gmail.com>
Subject Re: Query execution algorithm of Derby
Date Thu, 09 Dec 2010 15:14:40 GMT
> We are group of Undergraduate students (Computer science and Engineering)  of University
of Moratuwa. We are now working in a
> project on Derby query plan evaluation algorithm. Therefore we need some help on identifying
the code segments and classes
> related to query execution algorithm in Derby.

Welcome, and good luck with your project!

I'm not completely sure what you seek, since "query plan evaluation algorithm"
sounds like it's related to the cost-based optimizer, which looks at multiple
possible query plans and chooses the one with the lowest estimated cost, while
"query execution algorithm" sounds like it's related to the actual running
of the query, which involves join strategies, projection and restriction,
grouping and aggregation, ordering of results, transaction isolation, etc.

For a high-level understanding of the Derby internals, there are several
resources available, but the best current resources are:
1) The HowItWorks section of the Derby wiki: http://wiki.apache.org/db-derby/HowItWorks
2) The code itself: build it, run it, and conduct your own experiments by
populating sample tables and issuing sample queries against them, then read
the Derby query plan output for information about how Derby executed your query.

You'll also want to become familiar with the Tuning Derby guide, which describes
how Derby makes many of the internal tradeoffs necessary when executing queries,
and how to observe and control those behaviors:

 From a code point of view, you'll want to look at the packages
- org.apache.derby.impl.sql.compile, and
- org.apache.derby.impl.sql.execute

For example, if you're interested in query optimization, start by looking at
the optimize() method in SelectNode.java, then move on to studying the routines
in OptimizerImpl.java. Or if you're interested in how a nested-loops outer
join is executed, you'll want to look at NestedLoopLeftOuterJoinResultSet.java.

Good luck, and don't be afraid to ask more questions, either here or on the
derby-users list.



View raw message