Re: Yet another optimizer index choosing questions

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Elein <elein(at)nextbus(dot)com>
Cc: PostgreSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Yet another optimizer index choosing questions
Date: 2002-01-25 01:05:38
Message-ID: 20020124170027.T35837-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, 24 Jan 2002, Elein wrote:

>
> I have a four part primary key and only qualify
> the query on the table against the first part of
> the primary key.
>
> When I do the query, it never uses the primary key
> index.
>
> Does postgres use partial indexes at all?
> If so, the distribution of this one part of a primary
> key is very even. That is, each bucket has a
> similar count.
>
> I created a separate index on the first part of
> the primary key and the query used it and cut down
> the cost of the query significantly.
>
> The table has about 50K rows but the
> original query eats enough memory to choke postgres
> (yes, yes, I'll throw more memory at it, too).
> The query using the additional index works well.
>
> Why did I have to create a second index? Why
> didn't it use a partial of the primary key index?

It should be willing to use the first columns of the index
up until the first column not used for the scan AFAIK, can you send
the creates for the objects in question, queries and explain output?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hiroshi Inoue 2002-01-25 02:46:10 Re: persistent portals/cursors (between transactions)
Previous Message Tom Lane 2002-01-25 00:57:24 Re: Yet another optimizer index choosing questions