Re: A slow query - Help please?

From: "hubert depesz lubaczewski" <depesz(at)gmail(dot)com>
To: "Alban Hertroys" <alban(at)magproductions(dot)nl>
Cc: "Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: A slow query - Help please?
Date: 2006-06-17 10:12:38
Message-ID: 9e4684ce0606170312g5a1107bah9c51ca8969d01cb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 6/16/06, Alban Hertroys <alban(at)magproductions(dot)nl> wrote:
>
> We really need this solved. Isn't anybody able to shed some light on
> this? Is it possible to make this query use an index scan, preferably
> w/o disabling sequential scanning?
>

ditch the inheritance. it is no good, and makes everything too complicated
to work with.

in case you can't, do something similar to this:

select * from
(
select * from only table_a order by number desc limit 25
union
select * from only table_b order by number desc limit 25
union
select * from only table_c order by number desc limit 25
) x
order by number desc limit 25;

it should be faster. and yes, i know it's ugly.

depesz

--
http://www.depesz.com/ - nowy, lepszy depesz

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message P.M 2006-06-17 11:09:07 phppgadmin 4.0.1
Previous Message Florian G. Pflug 2006-06-17 00:24:12 Re: Fabian Pascal and RDBMS deficiencies in fully implementing