Re: slow query

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: 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 20:52:30
Message-ID: 200302231252.30681.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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.

--
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

  • slow query at 2003-02-21 16:30:53 from Oleg Lebedev

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Ryan Bradetich 2003-02-23 21:05:34 Re: slow query
Previous Message Josh Berkus 2003-02-23 20:44:06 Re: performance issues for processing more then 150000