Bug #49421 Documentation for single-part indexes unclear on definition of range conditions
Submitted: 3 Dec 2009 21:05 Modified: 16 Dec 2009 4:49
Reporter: Patrick Crews Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[3 Dec 2009 21:05] Patrick Crews
Description:
The documentation for single-part indexes seems unclear when describing what constitutes a range condition for BTREE indexes:
"The definition of a range condition for a single-part index is as follows:

For both BTREE and HASH indexes, comparison of a key part with a constant value is a range condition when using the =, <=>, IN(), IS NULL, or IS NOT NULL operators.

For BTREE indexes, comparison of a key part with a constant value is a range condition when using the >, <, >=, <=, BETWEEN, !=, or <> operators, or LIKE comparisons if the argument to LIKE is a constant string that does not start with a wildcard character."

The second paragraph's wording makes it unclear if it is describing extensions to the previous paragraph's definition of a range condition or whether this is another, more strict definition.  The reuse of comparison operators defined in the first paragraph contributes to this.

How to repeat:
See the manual:
http://dev.mysql.com/doc/refman/5.4/en/range-access-single-part.html

Suggested fix:
If the second paragraph is an extension (ie BTREE's also define range conditions as those that use BETWEEN and LIKE), I would recommend something like:

Additionally for BTREE indexes, comparison of a key part with a constant value is a range condition when using the BETWEEN operator or LIKE comparisons if the argument to LIKE is a constant string that does not start with a wildcard character
[16 Dec 2009 4:49] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

"The second paragraph's wording makes it unclear if it is describing extensions to the
previous paragraph's definition of a range condition or whether this is another, more
strict definition.  The reuse of comparison operators defined in the first paragraph
contributes to this."

I don't see any reuse. The operators in the two paragraphs are two distinct sets.

I will clarify that these operators are additional operators that make BTREE
comparisons a range condition.