Re: Antw: Re: Query questions

From: Richard Huxton <dev(at)archonet(dot)com>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, Christian(dot)Rengstl(at)klinik(dot)uni-regensburg(dot)de
Subject: Re: Antw: Re: Query questions
Date: 2006-07-31 16:29:52
Message-ID: 44CE3000.9060501@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

A. Kretschmer wrote:
> am 31.07.2006, um 15:55:39 +0100 mailte Richard Huxton folgendes:
>> Christian Rengstl wrote:
>>> My version is 8.1.4. Here is the plan for the query, it's performed on a
>>> Total runtime: 1903.894 ms
>>> And yes i have indexes on both pid (varchar(15)) and crit(varchar(13)).
>> That's not quite what Andreas asked. Do you have an index on (pid, crit)?
>
> He has 8.1, and i think, we have bitmap index scan for such tasks...
> (we don't need a index over both columns)

Hmm - I'd have assumed an index spanning both columns would be a win
where the selectivity was reasonable (as it looked here). Reading
through the original post, I'd be tempted to see if an index on
(pid,crit,iDate) could be used for the sorting too. If the planner is
smart enough to spot it, that would presumably be the best result.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2006-07-31 16:38:26 Re: Error in PostgreSQL query with psycopg
Previous Message Richard Huxton 2006-07-31 16:25:01 Re: Triggers in Postgres