facebookarchive / webscalesql-5.6

WebScaleSQL, Version 5.6, based upon the MySQL-5.6 community releases.
GNU General Public License v2.0
2.94k stars 356 forks source link

add precheck of column number, before check column by column #5

Closed tbdingqi closed 9 years ago

tbdingqi commented 10 years ago

Before check column by column, we can check whether the column number required is more than that in the index, if yes, prefix_index_cluster_optimization can not be used for this row.

chipturner commented 10 years ago

Can you clarify if this is an optimization or if this is a bugfix? If it is a bugfix, please include a test case that reproduces the bug that the patch fixes.

This looks like an optimization to me; if there are more fields in the template than in the index, sooner or later one won't be in the index, and we will fail on like 4739.

tbdingqi commented 10 years ago

To, chipturner . Yes, it is an optimization. You are right,In this case it will fail in 4739. But some compare calculation is done before. if prebuilt->n_template > index->n_fields added, unnecessary calculation is saved.

steaphan-fb-com commented 9 years ago

As suggested by the references, this was included in WebScaleSQL as of a while ago, most recently in:

https://github.com/webscalesql/webscalesql-5.6/commit/eb5af62f14e3f485f18b7b95409cb7e7fe2bc7e8

Sorry,I forgot to actually close out this PR when that got pushed.

Thanks!