Rajesh Kumar Mallah <[EMAIL PROTECTED]> writes: > -> Seq Scan on tickets main (cost=0.00..465.62 rows=1 width=164) > Filter: ((effectiveid = id) AND (("type")::text = 'ticket'::text) AND > (((status)::text = 'new'::text) OR ((status)::text = 'open'::text)))
This query has to read through every ticket in the system and check if the current user has access to it? It seems like this isn't going to be a terribly fast query no matter how you slice it. One thing that might help keep its run-time from growing is a partial index WHERE type = 'ticket' and (status = 'new' OR status = 'open') (I'm not sure what the point of the effectiveid=id clause is) That at least might help when 99% of your tickets are old closed tickets. But it will still have to scan through every new and open ticket which on some systems could be a large number. -- greg ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org