Re: slow query - Mailing list pgsql-performance

From Ryan Bradetich
Subject Re: slow query
Date
Msg-id 1046034334.13010.3.camel@beavis.ybsoft.com
Whole thread Raw
In response to Re: slow query  (Josh Berkus <josh@agliodbs.com>)
Responses Re: slow query
List 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@uswest.net>


pgsql-performance by date:

Previous
From: Josh Berkus
Date:
Subject: Re: slow query
Next
From: Josh Berkus
Date:
Subject: Re: slow query