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

CommentFileSizeAuthor
thread_id_create.patch913 bytescatch

Comments

berdir’s picture

Status: Needs review » Postponed (maintainer needs more info)

Uhm, 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....

catch’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
Issue tags: -Performance

This was apparently coming from a 'custom patch' to privatemsg_views, sorry!