Steve

Have you tried using compound index:

  INDEX( POOL, STATE )

Just a thought.

David

-----Original Message-----
From: Steve Katen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 10:13 AM
To: [EMAIL PROTECTED]
Subject: select query optimization


i am running a basic install of mysql version 3.23.49-log and i have a 
pretty simple query that is not fast enough for my needs.  any thoughts on 
optimization would help.

the table description is below:
mysql> desc RADPOOL;
+------------+----------+------+-----+---------+----------------+
| Field      | Type     | Null | Key | Default | Extra          |
+------------+----------+------+-----+---------+----------------+
| id         | int(11)  |      | PRI | NULL    | auto_increment |
| STATE      | int(11)  |      | MUL | 0       |                |
| TIME_STAMP | int(11)  | YES  |     | NULL    |                |
| EXPIRY     | int(11)  | YES  |     | NULL    |                |
| USERNAME   | char(50) | YES  |     | NULL    |                |
| POOL       | char(20) | YES  | MUL | NULL    |                |
| YIADDR     | char(50) |      | UNI |         |                |
+------------+----------+------+-----+---------+----------------+
7 rows in set (0.00 sec)

the query:
select TIME_STAMP, YIADDR from RADPOOL where POOL='GLOBAL-POOL-SJC' and 
STATE=0 order by TIME_STAMP limit 1

the mysql client shows that it takes .09 seconds
mysql> select TIME_STAMP, YIADDR from RADPOOL where POOL='GLOBAL-POOL-SJC' 
and STATE=0 order by TIME_STAMP limit 1;
+------------+-------------+
| TIME_STAMP | YIADDR      |
+------------+-------------+
| 1016494596 | 66.81.70.26 |
+------------+-------------+
1 row in set (0.09 sec)

how can i optimize the table, the database, or anything else that will 
speed the query up?

katen



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

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