[rt-users] TicketHistory slow on 4.2.0

Alex Vandiver alexmv at bestpractical.com
Fri Oct 25 17:22:21 EDT 2013


On Fri, 2013-10-25 at 16:56 -0400, Tod Detre wrote:
> Here are the EXPLAIN results: [snip]
>
> So it looks like the first query is using an index, but the second is
> not. I've confirmed that the ObjectCustomFieldValues table has the
> correct indexes listed in the schema.mysql. However the disabled field
> is not indexed. Should that be added?

The difficulty is that there is no index on ObjectType, ObjectId;
ObjectCustomFieldValues2 starts with the CustomField column, which is
not limited here, so it cannot be used.

Try adding the following index:

CREATE INDEX ObjectCustomFieldValues_Object
    ON ObjectCustomFieldValues(ObjectType, ObjectId, Disabled);

I additionally want to know what is generating that query.  Turning on
http://docs.bestpractical.com/RT_Config#StatementLog (on a
single-process development instance) will allow you to find which
component is generating the query, and if thus it is likely to be a call
path which others will encounter this problem with.  This will effect if
and how we fix this for others in 4.2.1
 - Alex




More information about the rt-users mailing list