Skip site navigation (1) Skip section navigation (2)

Re: slow query

From: Ryan Bradetich <rbradetich(at)uswest(dot)net>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Oleg Lebedev <oleg(dot)lebedev(at)waterford(dot)org>,"pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: slow query
Date: 2003-02-23 21:05:34
Message-ID: 1046034334.13010.3.camel@beavis.ybsoft.com (view raw or flat)
Thread:
Lists: pgsql-performance
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(at)uswest(dot)net>


In response to

Responses

pgsql-performance by date

Next:From: Josh BerkusDate: 2003-02-23 21:47:58
Subject: Re: slow query
Previous:From: Josh BerkusDate: 2003-02-23 20:52:30
Subject: Re: slow query

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group