Re: Which indexes does a query use?

From: "John D(dot) Burger" <john(at)mitre(dot)org>
To: PostgreSQL-general general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Which indexes does a query use?
Date: 2006-02-27 13:31:19
Message-ID: d189e7916c24cbd7228623b8d04b8397@mitre.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chris Velevitch wrote:

> Are you saying that the strategy pg uses is dynamic, in that as the
> size of the table grows the strategy changes?

The planner is quite dynamic, and what strategy it comes up with will
depend not just on the size of the table, but other things as well,
even on the particular constants in your comparisons. For instance, I
think your original query had:

where activity_user_id = 2

If the table statistics show that 2 is a very common value for that
column, the planner will not use the index, as it will not save enough.
(I think I have that right.)

- John D. Burger
MITRE

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Roman Neuhauser 2006-02-27 14:00:59 Re: majordomo unmaintained, postmaster emails ignored?
Previous Message Peter Eisentraut 2006-02-27 12:58:07 Re: Wish: remove ancient constructs from Postgres