Re: Weird indices

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Joseph Shraibman <jks(at)selectacast(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Weird indices
Date: 2001-02-20 02:50:35
Message-ID: Pine.BSF.4.21.0102191840260.85555-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 19 Feb 2001, Joseph Shraibman wrote:

> Joseph Shraibman wrote:
> >
>
> > Can't postgres do the index lookup first and find out there are only a
> > few tuples that might match?
> >
>

> o=# select count(*) from usertable where p in(1,33) group by p;
> count
> -------
> 16
> 502
> (2 rows)
>

> This raises some other questions. Why can't postgres get the count(*)
> from the index? Why doesn't it predict the correct number of rows in
> the planner? (25 estimated vs 16 actual).

First question: Mostly the same reason. Not all of the index entries
are necessarily real active rows that you can see, so you would still
have to hit the heap file to get that data, so I'd guess you're already
hitting the entire heap file.

[Tom answered the second]

In response to

Browse pgsql-general by date

  From Date Subject
Next Message adb 2001-02-20 02:51:43 Re: index used when casting to different type?
Previous Message Tom Lane 2001-02-20 02:47:01 Re: index used when casting to different type?