I was trying out a seemingly simple query - I just wanted to view a
ticket and all tickets that depend on it. So I created a query in RT
DependentOn = '813' OR id = '813'
However, this hung the DB (MySQL 4.0.15) with the SQL query:
(apparently never returns - I have to kill the select process)
SELECT COUNT(DISTINCT main.id) FROM Tickets main , Links Links_1 WHERE ((main.EffectiveId = main.id)) AND ((main.Status != 'deleted')) AND ( ( (Links_1.Type = 'DependsOn') AND(Links_1.LocalBase = '813') AND(main.id = Links_1.LocalTarget) ) OR(main.id = '813'))
The OR appears to cause a full table scan through the cross-product of
both databases. In my database, the Ticket has about 15,000 rows and
Links has about 25000 rows. I tried creating numerous indices on Links
but to no avail.
Is there a set up indices that I can create that can speed up this
Does RT create more intelligent SQL in future versions?