pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stuart McGraw <smcg2297@frii.com>
To: pgsql-sql@postgresql.org
Subject: slowness when subselect uses DISTINCT
Date: Wed, 18 Apr 2007 12:16:37 -0600
Message-ID: <AKEFJAHAPDBEDKIICNJKMEOHCCAA.smcg2297@frii.com> (raw)

I have several times now run into what seems
like similar performance problems with some 
of my postgresql queries.

I have a view that runs reasonably quicky.

I use this view in a subselect in another 
query and that query too runs reasonably
quicky.

The view returns some unwanted duplicate 
rows so I modify it using either DISTINCT 
or GROUP BY to eliminate them.
View still runs reasonably quickly.

I use the modified view as a subselect as
above, but now the query runs 2-3 orders
of magnitude more slowly than before.

Before I go through the effort of putting 
together a specific and concise test case, 
has anyone seen this general pattern and 
have an explanation or advice?  (PG-8.2.3)




view thread (4+ messages)  latest in thread

Message-ID: <AKEFJAHAPDBEDKIICNJKMEOHCCAA.smcg2297@frii.com>
Permalink:  ../AKEFJAHAPDBEDKIICNJKMEOHCCAA.smcg2297@frii.com/
Also on:    postgresql.org/message-id/AKEFJAHAPDBEDKIICNJKMEOHCCAA.smcg2297@frii.com

 · 

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-sql@postgresql.org
  Cc: smcg2297@frii.com
  Subject: Re: slowness when subselect uses DISTINCT
  In-Reply-To: <AKEFJAHAPDBEDKIICNJKMEOHCCAA.smcg2297@frii.com>

* 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