xunit delete: Xunit property performance improvements
I found that deleting an xunit from the database was very, very slow. This patch addresses the issue by adding additional indexes on the link_xunit_properties table to make it easier to find properties that are still in use. I also rework the `cleanup_xunit_properties` trigger to only check propids that were used by the deleted xunit. Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
This commit is contained in:
parent
a168a7f84b
commit
c3eb740fb5
|
@ -2,6 +2,26 @@
|
|||
|
||||
PRAGMA user_version = 2;
|
||||
|
||||
/*
|
||||
* The original `cleanup_xunit_properties` trigger was very slow on
|
||||
* large databases. We can do a few things to improve on it:
|
||||
* 1. Add an index on the link_xunits_props table to make it easier
|
||||
* to check if specific properties are still in use.
|
||||
* 2. Rewrite the `cleanup_xunit_properties` trigger to only operate
|
||||
* on the propid associated with the deleted xunit.
|
||||
*/
|
||||
CREATE INDEX link_xunit_props_propid_index ON link_xunit_props (propid);
|
||||
|
||||
DROP TRIGGER cleanup_xunit_properties;
|
||||
CREATE TRIGGER cleanup_xunit_properties
|
||||
AFTER DELETE ON link_xunit_props
|
||||
BEGIN
|
||||
DELETE FROM xunit_properties
|
||||
WHERE (propid = OLD.propid)
|
||||
AND NOT EXISTS (SELECT 1 FROM link_xunit_props
|
||||
WHERE propid = xunit_properties.propid);
|
||||
END;
|
||||
|
||||
/*
|
||||
* The original `cleanup_testcase_messages` trigger was very slow. We can
|
||||
* do a few things to improve upon it:
|
||||
|
|
Loading…
Reference in New Issue
Block a user