Hello there,
I have a MySQL table named 'mails', there are just over 12,000 records in this table.
One of my PHP scripts is taking absolutely forever to execute, upon going through the script, I found that all the MySQL queries are processed in under a second, except for this one:
SELECT *
FROM mails
WHERE mail_from = 'someone@somewhere.com'
ORDER BY mail_id DESC
When I run this query in phpMyAdmin, it takes over 115 seconds to execute. When this query is removed from my script,the remaining PHP script executes in just over a second.
Could someone explain to me what the cause of this can be please?
The database server is MYSQL 4.0.20 on a RedHat 9 install, Apache 2 with PHP 5. There are 23 tables in this database, 'mails' holds the most records and another table holds 10,000 records, although executing a WHERE query using that table is done in normal speed.
The server is a AMD Athlon 2100+ with 256MB RAM with 2 40GB 5200rpm hard disks across a RAID0 array.