Re: Indexs and prolems with. - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Indexs and prolems with.
Date
Msg-id 20020206120224.I18888-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Indexs and prolems with.  ("Michael McAlpine" <mikem@vis.oregonian.com>)
List pgsql-general
On Wed, 6 Feb 2002, Michael McAlpine wrote:

> Here are the results and the puzzle
>
> 1)  explain select * from table1 where charcol1 = 'asdfasd'
>      Index Scan using idx_charcol1  on table1  (cost=0.00..5.00 rows=1 width=456)
>
> 2)  explain select * from table1 where charcol1 like 'asdfa%'
>      Index Scan using idx_charcol1 on table1  (cost=0.00..5.00 rows=1 width=456)
>
> 3)  explain select * from table1 where charcol2 like "aefsadf%'
>      Index Scan using idx_charcol2 on table1  (cost=0.00..5.00 rows=1 width=456)
>
> but when I try
>
> 4)   explain select * from table1 where charcol2  = 'asdfasd'
>      Seq Scan on table1  (cost=0.00..234872.84 rows=168205 width=456)
>
>
> I have the proper locale setting for like queries ("C") and have
> recreated the indexes and vacuum analyzed but cannot get the last
> query to use the index.

How many rows are in the table?  It's estimating 168205 rows matching
asdfasd which could very possibly push it over to deciding on a sequence
scan.




pgsql-general by date:

Previous
From: "P.J. \"Josh\" Rovero"
Date:
Subject: Re: Postal code radius searches
Next
From: "Sykora, Dale"
Date:
Subject: Re: Postal code radius searches