Hello, it may be a simple question, but I can't get to it:

  Why this simple query does not use the PRIMARY key (which is oai_ui)?

mysql> explain select * from idb_metadata where oai_ui like 'doi:10.1088/0%';
+--------------+------+---------------+------+---------+------+--------+------------+
| table        | type | possible_keys | key  | key_len | ref  | rows   | Extra      |
+--------------+------+---------------+------+---------+------+--------+------------+
| idb_metadata | ALL  | PRIMARY       | NULL |    NULL | NULL | 178035 | where used |
+--------------+------+---------------+------+---------+------+--------+------------+

  While this is correctly using it....

mysql> explain select oai_ui from idb_metadata where oai_ui like 'doi:10.1088/0%';
+--------------+-------+---------------+---------+---------+------+--------+-------------------------+
| table        | type  | possible_keys | key     | key_len | ref  | rows   | Extra     
|              |
+--------------+-------+---------------+---------+---------+------+--------+-------------------------+
| idb_metadata | range | PRIMARY       | PRIMARY |      50 | NULL | 137387 | where 
|used; Using index |
+--------------+-------+---------------+---------+---------+------+--------+-------------------------+

The change is just that I select * instead of the column itself.

Thanks in advance to whoever can help..
running crazy in tuning,
Thanks

Fabrizio Nesti -- MediaLab -- SISSA -- IT




PS: System info:

Server:  3.23.38-max-log
Table desc (it has 178035 records):
mysql> desc idb_metadata;
+-------------+---------------+------+-----+---------+-------+
| Field       | Type          | Null | Key | Default | Extra |
+-------------+---------------+------+-----+---------+-------+
| oai_ui      | varchar(50)   |      | PRI |         |       |
| download    | date          | YES  |     | NULL    |       |
| datestamp   | date          | YES  |     | NULL    |       |
| updated     | timestamp(14) | YES  |     | NULL    |       |
| submission  | date          | YES  | MUL | NULL    |       |
| replacement | date          | YES  | MUL | NULL    |       |
| title       | text          | YES  |     | NULL    |       |
| abstract    | text          | YES  |     | NULL    |       |
| comment     | text          | YES  |     | NULL    |       |
| journal     | tinytext      | YES  |     | NULL    |       |
| url         | tinytext      | YES  |     | NULL    |       |
| type        | tinytext      | YES  |     | NULL    |       |
| language    | tinytext      | YES  |     | NULL    |       |
| rights      | tinytext      | YES  |     | NULL    |       |
| publisher   | tinytext      | YES  |     | NULL    |       |
| contributor | tinytext      | YES  |     | NULL    |       |
| format      | tinytext      | YES  |     | NULL    |       |
| source      | tinytext      | YES  |     | NULL    |       |
| relation    | tinytext      | YES  |     | NULL    |       |
| coverage    | tinytext      | YES  |     | NULL    |       |
| profiles    | tinyint(4)    | YES  |     | 1       |       |
+-------------+---------------+------+-----+---------+-------+








---------------------------------------------------------------------
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