| Bug #13455 | JOIN: different execution plans for (col=BETWEEN '0' AND '0') AND (col='0') | ||
|---|---|---|---|
| Submitted: | 24 Sep 2005 6:03 | Modified: | 30 Sep 2005 18:58 | 
| Reporter: | Georg Richter | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) | 
| Version: | 5.0.14-rc | OS: | Any (all) | 
| Assigned to: | Sergey Petrunya | CPU Architecture: | Any | 
   [24 Sep 2005 6:03]
   Georg Richter        
  
 
   [24 Sep 2005 6:08]
   Georg Richter        
  Table definition and data for bug #13455
Attachment: SQL.tar.bz2 (application/x-tbz, text), 144.16 KiB.
   [24 Sep 2005 6:36]
   MySQL Verification Team        
  mysql> EXPLAIN SELECT T1.* FROM SZMARA T1 JOIN SZMAKT T2 JOIN SZMVKE T3 WHERE T1.MANDT=T2.MANDT AND T1.MATNR=T2.MATNR AND T1.MANDT=T3.MANDT AN
D T1.MATNR=T3.MATNR AND T1.MATNR='000000000000001300'\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: T3
         type: index
possible_keys: PRIMARY
          key: PRIMARY
      key_len: 35
          ref: NULL
         rows: 7578
        Extra: Using where; Using index
*************************** 2. row ***************************
           id: 1
  select_type: SIMPLE
        table: T2
         type: ref
possible_keys: PRIMARY,SZMAKT~M
          key: PRIMARY
      key_len: 25
          ref: MY2.T3.MANDT,const
         rows: 1
        Extra: Using where; Using index
*************************** 3. row ***************************
           id: 1
  select_type: SIMPLE
        table: T1
         type: eq_ref
possible_keys: PRIMARY,SZMARA~L,SZMARA~O,SZMARA~T
          key: PRIMARY
      key_len: 25
          ref: MY2.T2.MANDT,const
         rows: 1
        Extra: Using where
3 rows in set (0.01 sec)
mysql> EXPLAIN SELECT T1.* FROM SZMARA T1 JOIN SZMAKT T2 JOIN SZMVKE
    -> T3 WHERE T1.MANDT=T2.MANDT AND T1.MATNR=T2.MATNR AND T1.MANDT=T3.MANDT AND
    -> T1.MATNR=T3.MATNR AND T1.MATNR BETWEEN '000000000000001300' AND
    -> '000000000000001300'\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: T1
         type: ALL
possible_keys: PRIMARY,SZMARA~L,SZMARA~O,SZMARA~T
          key: NULL
      key_len: NULL
          ref: NULL
         rows: 10044
        Extra: Using where
*************************** 2. row ***************************
           id: 1
  select_type: SIMPLE
        table: T3
         type: ref
possible_keys: PRIMARY
          key: PRIMARY
      key_len: 25
          ref: MY2.T1.MANDT,MY2.T1.MATNR
         rows: 1
        Extra: Using index
*************************** 3. row ***************************
           id: 1
  select_type: SIMPLE
        table: T2
         type: ref
possible_keys: PRIMARY,SZMAKT~M
          key: PRIMARY
      key_len: 25
          ref: MY2.T3.MANDT,MY2.T1.MATNR
         rows: 1
        Extra: Using where; Using index
3 rows in set (0.01 sec)
mysql> select version();
+-----------------+
| version()       |
+-----------------+
| 5.0.14-rc-debug |
+-----------------+
1 row in set (0.00 sec)
mysql>
 
   [29 Sep 2005 3:26]
   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/internals/30480
   [29 Sep 2005 3:55]
   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/internals/30482
   [29 Sep 2005 21:31]
   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/internals/30525
   [29 Sep 2005 22:57]
   Sergey Petrunya        
  Fix pushed into 5.0.14 tree. Fix description: ref optimizer is now able to use "ref" access method for "t.key BETWEEN c1 AND c1" (where c1 is a constant) constructs.
   [30 Sep 2005 3:03]
   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/internals/30536
   [30 Sep 2005 18:58]
   Paul DuBois        
  Noted in 5.0.14 changelog.
