[rt-devel] [BUG][major] It's now imposible search by two requestors.
Ruslan U. Zakirov
cubic at acronis.ru
Thu Sep 18 10:32:17 EDT 2003
First attachment is current SELECT(3.0.4 but also checked with delta
#211 with same result)
Second is right select that must be generated in case.
I know that we could say that mySQL can't optimize this simple query,
but it's obviouse that this is very-very bad query.
-------------- next part --------------
explain SELECT count(DISTINCT main.id)
FROM Tickets main,
Groups Groups_1,
Principals Principals_2,
CachedGroupMembers CachedGroupMembers_3,
Principals Principals_4,
Users Users_5,
Groups Groups_6,
Principals Principals_7,
CachedGroupMembers CachedGroupMembers_8,
Principals Principals_9,
Users Users_10
WHERE main.EffectiveId = main.id AND main.Type = 'ticket' AND
(
(
(
(Users_5.EmailAddress LIKE '%zander%') AND
(Groups_1.Domain = 'RT::Ticket-Role') AND
(Groups_1.Type = 'Requestor') AND
(Principals_2.PrincipalType = 'Group')
) OR (
(Users_10.EmailAddress LIKE '%cubic%') AND
(Groups_6.Domain = 'RT::Ticket-Role') AND
(Groups_6.Type = 'Requestor') AND
(Principals_7.PrincipalType = 'Group')
)
) AND (
(main.Status = 'resolved')
)
) AND
Groups_1.Instance = main.id AND
Groups_1.id = Principals_2.ObjectId AND
Principals_2.id = CachedGroupMembers_3.GroupId AND
CachedGroupMembers_3.MemberId = Principals_4.id AND
Principals_4.ObjectId = Users_5.id AND
Groups_6.Instance = main.id AND
Groups_6.id = Principals_7.ObjectId AND
Principals_7.id = CachedGroupMembers_8.GroupId AND
CachedGroupMembers_8.MemberId = Principals_9.id AND
Principals_9.ObjectId = Users_10.id;
-------------- next part --------------
SELECT count(DISTINCT main.id)
FROM Tickets main,
Groups Groups_1,
Principals Principals_2,
CachedGroupMembers CachedGroupMembers_3,
Users Users_5
WHERE main.EffectiveId = main.id AND main.Type = 'ticket' AND main.Status = 'resolved' AND
(Groups_1.Domain = 'RT::Ticket-Role') AND
(Groups_1.Type = 'Requestor') AND
(Principals_2.PrincipalType = 'Group') AND
Groups_1.Instance = main.id AND
Groups_1.id = Principals_2.ObjectId AND
Principals_2.id = CachedGroupMembers_3.GroupId AND
CachedGroupMembers_3.MemberId = Users_5.id AND
(
Users_5.EmailAddress LIKE '%test%' OR Users_5.EmailAddress LIKE '%cubic%'
)
More information about the Rt-devel
mailing list