All pastes #746850 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-10-23 15:14 UTC
rendered paste body
mysql> show index from EZImpression.tblEZImpressionOrders;
+-----------------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table                 | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-----------------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| tblEZImpressionOrders |          0 | PRIMARY  |            1 | EZID        | A         |    29895257 |     NULL | NULL   |      | BTREE      |         |
| tblEZImpressionOrders |          0 | PRIMARY  |            2 | OrderID     | A         |    29895257 |     NULL | NULL   |      | BTREE      |         |
| tblEZImpressionOrders |          1 | Status   |            1 | Status      | A         |          16 |     NULL | NULL   |      | BTREE      |         |
+-----------------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
3 rows in set (0.30 sec)


mysql> Explain  select * from  EZImpression.tblEZImpressionOrders  WHERE Status = 9 and (
    -> (EZID='12717399' and OrderID ='29570') or
    -> (EZID='12719767' and OrderID =29570) or
    -> (EZID='12719767' and OrderID =29571) or
    ->
    -> (EZID='12719768' and OrderID =29571) or
    -> (EZID='12719770' and OrderID =29570)
    -> );
+----+-------------+-----------------------+-------+----------------+---------+---------+------+------+-------------+
| id | select_type | table                 | type  | possible_keys  | key     | key_len | ref  | rows | Extra       |
+----+-------------+-----------------------+-------+----------------+---------+---------+------+------+-------------+
|  1 | SIMPLE      | tblEZImpressionOrders | range | PRIMARY,Status | PRIMARY | 6       | NULL |    4 | Using where |
+----+-------------+-----------------------+-------+----------------+---------+---------+------+------+-------------+
1 row in set (0.00 sec)

mysql> Explain  select * from  EZImpression.tblEZImpressionOrders  WHERE Status = 9 and (EZID,OrderID)  IN (('12717399' ,'29570') ,('12719767',29570) ,
    -> ('12719767' ,29571) ,  ('12719768' ,29571) , ('12719770',29570)
    -> );
+----+-------------+-----------------------+------+---------------+--------+---------+-------+---------+-------------+
| id | select_type | table                 | type | possible_keys | key    | key_len | ref   | rows    | Extra       |
+----+-------------+-----------------------+------+---------------+--------+---------+-------+---------+-------------+
|  1 | SIMPLE      | tblEZImpressionOrders | ref  | Status        | Status | 1       | const | 5747652 | Using where |
+----+-------------+-----------------------+------+---------------+--------+---------+-------+---------+-------------+
1 row in set (0.00 sec)