This'll probably show my ignorance, but can someone explain why this
select uses index on ob_vl_parametry.info_cs when that column is not
used anywhere in the query?

 mysql> EXPLAIN SELECT vp.id
     -> FROM ob_vl_parametry_zbozi zp, ob_vl_parametry vp,
     -> ob_vl_parametry_kategorie vpk
     -> WHERE zp.id_zbozi IN (409)
     -> AND vp.id = zp.id_par
     -> AND vp.id = vpk.id_par
     -> ORDER BY zp.poradi\G
*************************** 1. row ***************************
        table: vp
         type: index
possible_keys: PRIMARY
          key: info_cs
      key_len: 1
          ref: NULL
         rows: 59
        Extra: Using index; Using temporary; Using filesort
*************************** 2. row ***************************
        table: vpk
         type: ref
possible_keys: PRIMARY
          key: PRIMARY
      key_len: 8
          ref: vp.id
         rows: 8
        Extra: Using index
*************************** 3. row ***************************
        table: zp
         type: ref
possible_keys: id_par
          key: id_par
      key_len: 4
          ref: vp.id
         rows: 126
        Extra: Using where; Using index
3 rows in set (0.00 sec)

 mysql> show keys from ob_vl_parametry\G
 *************************** 1. row ***************************
        Table: ob_vl_parametry
   Non_unique: 0
     Key_name: PRIMARY
 Seq_in_index: 1
  Column_name: id
    Collation: A
  Cardinality: 59
     Sub_part: NULL
       Packed: NULL
         Null: 
   Index_type: BTREE
      Comment: 
 *************************** 2. row ***************************
        Table: ob_vl_parametry
   Non_unique: 1
     Key_name: info_cs
 Seq_in_index: 1
  Column_name: info_cs
    Collation: A
  Cardinality: 29
     Sub_part: 1
       Packed: NULL
         Null: 
   Index_type: BTREE
      Comment: 
 *************************** 3. row ***************************
        Table: ob_vl_parametry
   Non_unique: 1
     Key_name: nazev_cs
 Seq_in_index: 1
  Column_name: nazev_cs
    Collation: A
  Cardinality: 59
     Sub_part: NULL
       Packed: NULL
         Null: 
   Index_type: BTREE
      Comment: 
 3 rows in set (0.01 sec)

-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to