Re: Does indexing help >= as well as = for integer columns?

From: TJ O'Donnell <tjo(at)acm(dot)org>
To: pgsql-general(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, lists(at)boutiquenumerique(dot)com
Subject: Re: Does indexing help >= as well as = for integer columns?
Date: 2005-02-02 14:51:13
Message-ID: 4200E8E1.6020301@acm.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I had thought that the Creation of the Index would do something
equivalent to Analyze. I tried Analyze Verbose and it improved
the scanner's ability to predict when an index would be useful.

Last week, I asked about visualizing B-tree "coverage". I think
I meant "Can I see the histograms that Analyze creates?"
Are they available anywhere? The docs mention them (bins) and I
was hoping Analyze Verbose would show them to me.

TJ

Tom Lane wrote:
> "TJ O'Donnell" <tjo(at)acm(dot)org> writes:
>
>>This I don't get. Why is an index scan not used? Isn't an index supposed
>>to help when using > < >= <= too?
>>Explain Analyze Select count(smiles) from structure where _c >= 30
>>Aggregate (cost=196033.74..196033.74 rows=1 width=32) (actual time=42133.432..42133.434 rows=1
>>loops=1)
>> -> Seq Scan on structure (cost=0.00..191619.56 rows=1765669 width=32) (actual
>>time=8050.437..42117.062 rows=1569 loops=1)
>> Filter: (_c >= 30)
>
>
> Have you ANALYZEd the table lately? That rowcount estimate is off by
> about three orders of magnitude :-(
>
> regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Postgre.News.Firma 2005-02-02 15:14:13 NewsServer down ?
Previous Message Richard Huxton 2005-02-02 14:48:41 Re: query time