pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Oleg Lebedev <oleg.lebedev@waterford.org>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: slow query
Date: Sun, 23 Feb 2003 12:52:30 -0800
Message-ID: <200302231252.30681.josh@agliodbs.com> (raw)
In-Reply-To: <993DBE5B4D02194382EC8DF8554A5273033583@postoffice.waterford.org>
References: <993DBE5B4D02194382EC8DF8554A5273033583@postoffice.waterford.org>

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



view thread (112+ messages)  latest in thread

Message-ID: <200302231252.30681.josh@agliodbs.com>
Permalink:  ../200302231252.30681.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200302231252.30681.josh@agliodbs.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: josh@agliodbs.com, oleg.lebedev@waterford.org
  Subject: Re: slow query
  In-Reply-To: <200302231252.30681.josh@agliodbs.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