Re: Functional Indices - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Functional Indices
Date
Msg-id Pine.LNX.4.30.0105222139510.757-100000@peter.localdomain
Whole thread Raw
In response to Functional Indices  (kavoos <kavoos@issn.org>)
Responses Re: Estimating costs (was Functional Indices)  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
kavoos writes:

> create index lower_title on titles (lower(title));
> vacuum analyze;
> ...
> explain select * from titles where lower(title) = 'monde';
> Seq Scan on titles  (cost=0.00..39392.10 rows=14145 width=44)
>
> Why it does not use the index ?

The planner estimates that this query returns 14145 rows.  If this is more
than a small fraction of the rows in this table then a sequential scan is
better than an index scan.

The questions are, how many rows does this query really return, and how
many rows are in this table.  Btw., this is discussed in the manual under
performance tips.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


pgsql-general by date:

Previous
From: "Dave Cramer"
Date:
Subject: Re: I want more Money (the data type, of course! :-))
Next
From: Stephan Szabo
Date:
Subject: Re: Functional Indices