On Thu, Jul 21, 2016 at 11:48 AM, Johan Fredriksson <eskil@xxxxxx> wrote: > EXPLAIN ANALYZE VERBOSE SELECT DISTINCT main.* FROM Users main CROSS > JOIN ACL ACL_3 JOIN Principals Principals_1 ON ( Principals_1.id = > main.id ) JOIN CachedGroupMembers CachedGroupMembers_2 ON > ( CachedGroupMembers_2.MemberId = Principals_1.id ) JOIN > CachedGroupMembers CachedGroupMembers_4 ON > ( CachedGroupMembers_4.MemberId = Principals_1.id ) WHERE > ((ACL_3.ObjectType = 'RT::Queue' AND ACL_3.ObjectId = 85) OR > (ACL_3.ObjectType = 'RT::System' AND ACL_3.ObjectId = 1)) AND > (ACL_3.PrincipalId = CachedGroupMembers_4.GroupId) AND > (ACL_3.PrincipalType = 'Group') AND (ACL_3.RightName = 'OwnTicket') AND > (CachedGroupMembers_2.Disabled = '0') AND (CachedGroupMembers_2.GroupId > = '4') AND (CachedGroupMembers_4.Disabled = '0') AND > (Principals_1.Disabled = '0') AND (Principals_1.PrincipalType = 'User') > AND (Principals_1.id != '1') ORDER BY main.Name ASC; That cross join doesn't look right. It has no join condition. -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance