Database Management Systems

by Raghu Ramakrishnan and Johannes Gehrke

Query Page

A query in Minibase follows this path:

  • User enters query using SQL (or using the QBE front end; if QBE is used, the query is translated to SQL).
  • The parser reads the SQL query and checks for syntactic validity.
  • The optimizer checks the catalog and makes sure that the relations exist, that the user has used the proper attribute names, etc. Similar to type checking.
  • The optimizer then creates possible plans, using heuristics and catalog information (e.g., cardinalities and availability of indexes) to find the best plan.
  • The planner then walks down the tree, calling itself recursively. It creates an iterator tree.
  • At run-time, tuples are returned one at a time through the a get_next call on the iterator at the root of the iterator tree.

Details

There are two ways to return tuples of a query. The first is to return a pointer into the buffer pool to the record. This would only work for simple scans, without projections or joins. The limitations of this method are obvious, and it is made even more difficult because then the low level record space management (heap files for example) would pin the page in the buffer pool and the upper layer would need to unpin the page.

The other method is to copy tuples into dynamically allocated main memory. This is the choice that was made in Minibase.

Back to the Components Page
Back to the Minibase Home Page