Commit 3d212688 authored by Kevin Falcone's avatar Kevin Falcone
Browse files

Improve our Dependent Subclause

When MySQL optimizes our UPDATE where id in (SELECT) it doesn't know
that the tables are linked, so it ends up walking and examining lots and
lots of rows.  Including the ObjectType column means that mysql can
easily examine 1 row using our existing ObjectCustomFieldValues2 index
and update immediately.

There is no longer a need to add upgrade specific indexes for OCFVs (the
transaction indexes still improve performance).
parent f6dcd4cb
......@@ -19,7 +19,6 @@ improve the performance of the upgrade.
CREATE INDEX UPGRADE_TRANSACTIONS_TYPE ON Transactions (Type, Field);
CREATE INDEX UPGRADE_TRANSACTIONS_NEW ON Transactions(Field,ObjectType, Type, NewReference);
CREATE INDEX UPGRADE_TRANSACTIONS_OLD on Transactions(Field,ObjectType, Type, OldReference);
CREATE INDEX UPGRADE_OCFV_STATUS ON ObjectCustomFieldValues(Content,Disabled,CustomField);
These should be removed following a successful since they are unlikely
to be useful in normal RTIR usage.
......@@ -27,7 +26,6 @@ to be useful in normal RTIR usage.
DROP INDEX UPGRADE_TRANSACTIONS_TYPE ON Transactions;
DROP INDEX UPGRADE_TRANSACTIONS_NEW ON Transactions;
DROP INDEX UPGRADE_TRANSACTIONS_OLD ON Transactions;
DROP INDEX UPGRADE_OCFV_STATUS ON ObjectCustomFieldValues;
=head2 Lifecycles
......
......@@ -169,6 +169,7 @@ our @Final = (
$values->Limit( FIELD => 'CustomField', VALUE => $cf->id );
$values->Limit( FIELD => 'Disabled', VALUE => 0 );
$values->Limit( FIELD => 'Content', VALUE => $state );
$values->Limit( FIELD => 'ObjectType', VALUE => 'RT::Ticket' );
$values->Columns('ObjectId');
$values->OrderBy();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment