Indexs and prolems with. - Mailing list pgsql-general

From Michael McAlpine
Subject Indexs and prolems with.
Date
Msg-id sc6115a5.094@gw.oregonian.com
Whole thread Raw
Responses Re: Indexs and prolems with.  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: Indexs and prolems with.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Greetings,

I have been having with some indexing problems and was hoping someone might have some insights.

In short.  I have  table1 with charcol1 -  char(9)  and  charcol2  -  char(7)

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
getthe last query to use the index.   

Any help would be greatly appreciated.

Michael

The Oregonian
Portland Oregon





pgsql-general by date:

Previous
From: Vince Vielhaber
Date:
Subject: Re: Postal code radius searches
Next
From: "Roderick A. Anderson"
Date:
Subject: Re: Postal code radius searches