[rt-users] Inefficient query generation? (RT 3.2.2)

Kumar, Vasanth vakumar at blackrock.com
Wed Dec 15 19:16:05 EST 2004


Hi,

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
(3.2.2):

	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
query?

Does RT create more intelligent SQL in future versions?

Thanks!



More information about the rt-users mailing list