Re: query slow problem

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: frank_lupo <frank_lupo(at)email(dot)it>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: query slow problem
Date: 2002-07-29 15:35:08
Message-ID: 20020729082717.H93026-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Mon, 29 Jul 2002, frank_lupo wrote:

> select id,de2 from irtab where id in (select distinct(ruolofunz) from
> irelbtes_1 where entpian=118331)\g

In optimizes poorly currently in postgres, so you're generally better
off converting to EXISTS or subselect in FROM. Something like
(untested):

select id, de2 from irtabl where exists (select 1 from
irelbtes_1 where entpian=118331 and irtabl.id=ruolofunz)

or

select id, de2 from irtabl, (select distinct(ruolofunz) as r from
irelbtes_1 where entpian=118331) as i
where i.r=irtabl.id;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Markus Wollny 2002-07-29 15:38:59 Re: tsearch - Regression tests fail
Previous Message frank_lupo 2002-07-29 15:16:40 query slow problem