Merge lp:~laurynas-biveinis/percona-server/tokudb-clustering-query-opt into lp:percona-server/5.6
Status: | Merged |
---|---|
Approved by: | Alexey Kopytov |
Approved revision: | no longer in the source branch. |
Merged at revision: | 572 |
Proposed branch: | lp:~laurynas-biveinis/percona-server/tokudb-clustering-query-opt |
Merge into: | lp:percona-server/5.6 |
Prerequisite: | lp:~laurynas-biveinis/percona-server/tokudb-multiple-clust-keys |
Diff against target: |
109 lines (+37/-8) 3 files modified
sql/handler.h (+1/-0) sql/sql_planner.cc (+4/-2) sql/sql_select.cc (+32/-6) |
To merge this branch: | bzr merge lp:~laurynas-biveinis/percona-server/tokudb-clustering-query-opt |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexey Kopytov (community) | Approve | ||
Review via email: mp+211810@code.launchpad.net |
This proposal supersedes a proposal from 2014-01-23.
Description of the change
2nd MP:
- removed MY_TEST
- added missing tab->do_loosescan guard
- removed the extra arg to find_shortest_key. Its call to find the shortest clustering key was replaced by passing the clustering tab->keys subset instead.
- adjusted find_shortest_key not to prefer PK over secondary key over all table columns if the secondary key is clustering.
http://
1st MP:
Implement (probably partial) query optimizer support for secondary
clustering keys,
https:/
- Declare new index flag HA_CLUSTERED_INDEX, which a storage engine is
supposed to return in index_flags() for any secondary clustered index.
- Extend find_shortest_key() to consider any clustering keys as
suitable for full table scans too. Moreover, add new arg bool
sec_clusterin
consider secondary clustering keys only. Pass false from all
existing callers to keep the current behavior.
- Modify Optimize_
clustering keys as covering keys (no row read required) for access
time estimates.
- In make_join_
join if no suitable covering keys and before resorting to table
scan.
- In test_if_
keys too.
- In test_if_
covering keys.
http://
- all MY_TEST() occurrences in the patch are unnecessary (“if (a ? 1 :
0)” is equivalent to “if (a)”)
- HA_CLUSTERED_INDEX can only be set for secondary indexes. Making key_is_ clustered( key) || flags(key) & HA_CLUSTERED_INDEX)
index_flags() return HA_CLUSTERED_INDEX for PK in InnoDB tables
would simplify a couple of cumbersome checks like “if (key == PK
&& primary_
index_
- in the following code the check for best_clust_is_pk is redundant:
if (sec_clustering _only)
return best_clust_is_pk ? MAX_KEY : best_clustered;
- no check for tab->do_loosescan() around the find_shortest_ key(... ,
true) call?
- the additional argument to find_shortest_key() and the logic around >select- >quick to be NULL.
it look fishy. The intention was that if we are going to do a full
table scan, but have no covering keys on the table (if we had, that
would be converted to an index scan by existing logic), look for the
shortest TokuDB CLUSTERING key in tab->keys and convert the table
scan to an index scan on the shortest one, if any. But I see nothing
that would guarantee TokuDB CLUSTERING keys to be present in
tab->keys? Moreover, tab->keys is a list of possible keys that could
be used to optimize an index scan with conditions on that
index. Which is excluded by requiring either tab->select or
tab-
On top of that, the second argument to find_shortest_key() is
already supposed to indicate which keys we should be looking at. So
introducing another argument with the sane semantics looks
redundant. Can we use a pre-created bitmap of CLUSTERING keys
instead?
- these changes are obviously asking for regression tests. Combined
with my previous suggestion on disabling CLUSTERING keys for
non-TokuDB tables, this means TokuDB SE should be a prerequisite for
this MP. TokuDB probably already has this covered in its own test
suite? Even if it doesn’t, basing this MP on a tree with TokuDB
included would allow to create a proper test case.