Re: Query puts 7.3.4 on endless loop but 7.4beta5 is fine. - Mailing list pgsql-performance

From Greg Stark
Subject Re: Query puts 7.3.4 on endless loop but 7.4beta5 is fine.
Date
Msg-id 87znfid1ya.fsf@stark.dyndns.tv
Whole thread Raw
In response to Re: Query puts 7.3.4 on endless loop but 7.4beta5 is fine.  (Rajesh Kumar Mallah <mallah@trade-india.com>)
List pgsql-performance
Rajesh Kumar Mallah <mallah@trade-india.com> 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

pgsql-performance by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: vacuum locking
Next
From: Josh Berkus
Date:
Subject: Re: vacuum locking