Category: Optimizer

MySQL Internals Optimizer/Condition Pushdown

MySQL table engine interface supports table condition pushdown (since 5.0) and index condition pushdown (since 5.2).

[edit] Table Condition Pushdown

Table condition pushdown is useful for table engines that have some kind of "smart but remote" storage for table rows, like NDB or Federated. In this case, the common approach of retrieving table rows into mysqld process and then checking the table condition is not optimal. A faster way is to push the table condition down into the "smart storage", check it there, and retrieve only the matching rows.

MySQL provides support for this action: storage engine can return HA_DO_COND_PUSH flag from the table_flags() call (TODO: make it so), and then the SQL layer will pass the table condition to the table engine in handler->cond_push() call.

The engine's "smart storage" layer doesn't have to be able to evaluate arbitrary SQL conditions (with any MySQL functions, UDFs and so forth). It can have limited capabilities, e.g. only do column vs constant comparisons (like NDBCluster does).

If the table engine cannot check the entire table condition, it should extract the part of condition it can check and return the remainder back to SQL layer. There is no Storage Engine API call to do that, but you can borrow MySQL code that does that.

TODO: Describe

make_cond_for_info_schema()

make_cond_for_index() / make_cond_remainder()


[edit] Index Condition Pushdown

TODO

Retrieved from "http://forge.mysql.com/wiki/MySQL_Internals_Optimizer/Condition_Pushdown"

This page has been accessed 649 times. This page was last modified 01:41, 6 July 2007.

Find

Browse
MySQLForge
Main Page
Current events
Recent changes
Random page
Help
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Special pages
New pages
File list
Statistics
Bug reports
More...