SELECT uid FROM pm_index WHERE thread_id = ? AND created is NULL isn't indexed.
mysql> EXPLAIN SELECT uid FROM pm_index WHERE thread_id = 2 AND created IS NULL;
---------------+----------+------+-----------------------------------------+--------------+---------+-------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
---------------+----------+------+-----------------------------------------+--------------+---------+-------+------+-------------+ | 1 | SIMPLE | pm_index | ref | participants,thread_id,pm_index_created | participants | 4 | const | 1 | Using where |
--------------
The query came up in NewRelic as taking over 400ms (with a different thread_id - I believe there were a large numbers of users on the thread).
| Comment | File | Size | Author |
|---|---|---|---|
| thread_id_create.patch | 913 bytes | catch |
Comments
Comment #1
berdirUhm, there is no created column in pm_index in our schema? See http://api.worldempire.ch/api/privatemsg/privatemsg.install/function/pri...
No idea where that thing is coming from....
Comment #2
catchThis was apparently coming from a 'custom patch' to privatemsg_views, sorry!