Michal,
Tuesday, December 03, 2002, 7:19:08 PM, you wrote:

MF> Its possible to use index on this query ??

MF> select .. 
MF> from .. 
MF> where   timestamp_col<20021101000000  and  timestamp_col>20011101000000

MF> I have index on timestamp column, but EXPLAIN says that not using any of
MF> possible keys.
MF> I also try using BETWEEN function instead of two compares, but same result.

Yes, it's possible:

mysql> explain select id from mybox where mydate < 20020610010101 and mydate > 
20020101010101\G
*************************** 1. row ***************************
        table: mybox
         type: range
possible_keys: mydate
          key: mydate
      key_len: 4
          ref: NULL
         rows: 20727
        Extra: where used
1 row in set (0.01 sec)

What is the output of explain? What is the table structure? What
indexes are in the table? How many rows in the table? What is the
version of MySQL server?



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to