pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ryan Bradetich <rbradetich@uswest.net>
To: Josh Berkus <josh@agliodbs.com>
Cc: Oleg Lebedev <oleg.lebedev@waterford.org>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: slow query
Date: 23 Feb 2003 14:05:34 -0700
Message-ID: <1046034334.13010.3.camel@beavis.ybsoft.com> (raw)
In-Reply-To: <200302231252.30681.josh@agliodbs.com>
References: <993DBE5B4D02194382EC8DF8554A5273033583@postoffice.waterford.org>
	<200302231252.30681.josh@agliodbs.com>

On Sun, 2003-02-23 at 13:52, Josh Berkus wrote:
> Oleg,
> 
> > I VACUUM ANALYZED both databases and made sure they have same indexes on
> > the tables.
> 
> Have you VACUUM FULL the main database?  And how about REINDEX?  
> 
> > Here is the query:
> > SELECT * FROM media m, speccharacter c
> > WHERE m.mediatype IN (SELECT objectid FROM mediatype WHERE
> > medianame='Audio')
> 
> The above should use an EXISTS clause, not IN, unless you are absolutely sure 
> that the subquery will never return more than 12 rows.

I am assuming you said this because EXISTS is faster for > 12 rows? 
Interesting :)

thanks,

- Ryan


-- 
Ryan Bradetich <rbradetich@uswest.net>




view thread (112+ messages)  latest in thread

Message-ID: <1046034334.13010.3.camel@beavis.ybsoft.com>
Permalink:  ../1046034334.13010.3.camel@beavis.ybsoft.com/
Also on:    postgresql.org/message-id/1046034334.13010.3.camel@beavis.ybsoft.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-performance@postgresql.org
  Cc: rbradetich@uswest.net, josh@agliodbs.com, oleg.lebedev@waterford.org
  Subject: Re: slow query
  In-Reply-To: <1046034334.13010.3.camel@beavis.ybsoft.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