pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: Rajesh Kumar Mallah <mallah@trade-india.com>
Cc: Christopher Browne <cbbrowne@acm.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query puts 7.3.4 on endless loop but 7.4beta5 is fine.
Date: 30 Oct 2003 13:18:05 -0500
Message-ID: <87znfid1ya.fsf@stark.dyndns.tv> (raw)
In-Reply-To: <3FA323C2.2060302@trade-india.com>
References: <33298.203.145.130.142.1067457626.squirrel@mail.trade-india.com>
	<20031029202920.GZ7337@pallas.fsck.com>
	<33402.203.145.130.142.1067460429.squirrel@mail.trade-india.com>
	<200310301702.00275.mallah@trade-india.com>
	<m33cdakhv7.fsf@wolfe.cbbrowne.com>
	<13042.61.16.154.82.1067523120.squirrel@mail.trade-india.com>
	<m3smlaiww8.fsf@wolfe.cbbrowne.com>
	<3FA323C2.2060302@trade-india.com>

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




view thread (16+ messages)  latest in thread

Message-ID: <87znfid1ya.fsf@stark.dyndns.tv>
Permalink:  ../87znfid1ya.fsf@stark.dyndns.tv/
Also on:    postgresql.org/message-id/87znfid1ya.fsf@stark.dyndns.tv

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: gsstark@mit.edu, mallah@trade-india.com, cbbrowne@acm.org
  Subject: Re: Query puts 7.3.4 on endless loop but 7.4beta5 is fine.
  In-Reply-To: <87znfid1ya.fsf@stark.dyndns.tv>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox