| Bug #32942 | now() - interval '7200' second is NOT pre-calculated, causing "full table scan" | ||
|---|---|---|---|
| Submitted: | 3 Dec 2007 20:20 | Modified: | 15 Mar 8:35 |
| Reporter: | Valeriy Kravchuk | ||
| Status: | Closed | ||
| Category: | Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.45 | OS: | Any |
| Assigned to: | Alexey Botchkov | Target Version: | 5.0+ |
| Tags: | regression | ||
| Triage: | D3 (Medium) | ||
[3 Dec 2007 20:20]
Valeriy Kravchuk
[11 Dec 2007 14:28]
Timour Katchaounov
Suggestion: Check if the problem is related to item_cmpfunc::convert_constant_item().
[15 Feb 8:52]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/42330 ChangeSet@1.2584, 2008-02-15 11:43:55+04:00, holyfoot@mysql.com +1 -0 Bug #32942 now() - interval '7200' second NOT pre-calculated, causing "full table scan" Problem is not about intervals and doesn't actually cause 'full table scan'. We have an optimization for DISTINCT when we have 'DISTINCT field_from_first_join_table' we don't need to read all the rows from the JOIN-ed table if we found one conforming row. It stopped working in 5.0 as we return NESTED_LOOP_OK if we came upon that case in the evaluate_join_record() and that doesn't break the recordreading loop in sub_select(). Fixed by returning NESTED_LOOP_NO_MORE_ROWS in this case.
[15 Feb 20:07]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/42395 ChangeSet@1.2584, 2008-02-15 22:58:56+04:00, holyfoot@mysql.com +3 -0 Bug #32942 now() - interval '7200' second NOT pre-calculated, causing "full table scan" Problem is not about intervals and doesn't actually cause 'full table scan'. We have an optimization for DISTINCT when we have 'DISTINCT field_from_first_join_table' we don't need to read all the rows from the JOIN-ed table if we found one conforming row. It stopped working in 5.0 as we return NESTED_LOOP_OK if we came upon that case in the evaluate_join_record() and that doesn't break the recordreading loop in sub_select(). Fixed by returning NESTED_LOOP_NO_MORE_ROWS in this case.
[17 Feb 12:56]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/42451 ChangeSet@1.2584, 2008-02-17 15:48:17+04:00, holyfoot@mysql.com +3 -0 Bug #32942 now() - interval '7200' second NOT pre-calculated, causing "full table scan" Problem is not about intervals and doesn't actually cause 'full table scan'. We have an optimization for DISTINCT when we have 'DISTINCT field_from_first_join_table' we don't need to read all the rows from the JOIN-ed table if we found one conforming row. It stopped working in 5.0 as we return NESTED_LOOP_OK if we came upon that case in the evaluate_join_record() and that doesn't break the recordreading loop in sub_select(). Fixed by returning NESTED_LOOP_NO_MORE_ROWS in this case.
[13 Mar 20:28]
Bugs System
Pushed into 6.0.5-alpha
[13 Mar 20:35]
Bugs System
Pushed into 5.1.24-rc
[13 Mar 20:42]
Bugs System
Pushed into 5.0.60
[15 Mar 8:35]
Jon Stephens
Documented in the 5.0.60, 5.1.24, and 6.0.5 changelogs as follows (as requested by James
Day):
For DISTINCT queries, 4.0 and 4.1 stopped reading
joined tables as soon as the first matching row was found. However, this
optimzation was lost in MySQL 5.0, which instead read all matching rows.
This fix for this regression may result in a major improvement in
performance for DISTINCT queries in cases where many
rows match.
[31 Mar 21:52]
Jon Stephens
Pushed to 5.1-telco-6.3, documented in the 5.1.23-ndb-6.3.11 changelog.
