Re: Does indexing help >= as well as = for integer columns? - Mailing list pgsql-general

From Tom Lane
Subject Re: Does indexing help >= as well as = for integer columns?
Date
Msg-id 18111.1107286239@sss.pgh.pa.us
Whole thread Raw
In response to Does indexing help >= as well as = for integer columns?  ("TJ O'Donnell" <tjo@acm.org>)
Responses Re: Does indexing help >= as well as = for integer columns?
Re: Does indexing help >= as well as = for integer columns?
List pgsql-general
"TJ O'Donnell" <tjo@acm.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

pgsql-general by date:

Previous
From: PFC
Date:
Subject: Re: Does indexing help >= as well as = for integer columns?
Next
From: perico@12move.nl
Date:
Subject: codepage setting, \encoding