Re: RES: Mutiple SQL request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




MySQL may have noticed it was impossible with the current data he had
using the index on that field, but in the future it may become valid, so
I wouldn't necessary eliminate it if it's deemed crucial. A query that
returns no results is equally as useful as one that returns many.

I'm not arguing about the index, I'm saying you can't use that particular example to try and optimize the db.

In mysql you cannot use explain on a query that returns no results. Every time it will give the "impossible where noticed" error.

mysql> create table test (id int);
Query OK, 0 rows affected (0.06 sec)

mysql> insert into test(id) values (1);
Query OK, 1 row affected (0.06 sec)

mysql> explain select * from test where id=1\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: test
         type: system
possible_keys: NULL
          key: NULL
      key_len: NULL
          ref: NULL
         rows: 1
        Extra:
1 row in set (0.00 sec)

mysql> explain select * from test where id=2\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: NULL
         type: NULL
possible_keys: NULL
          key: NULL
      key_len: NULL
          ref: NULL
         rows: NULL
        Extra: Impossible WHERE noticed after reading const tables
1 row in set (0.01 sec)

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux