Re: can't seem to use index - Mailing list pgsql-general

From admin
Subject Re: can't seem to use index
Date
Msg-id Pine.BSF.4.10.10001101759580.54163-100000@server.b0x.com
Whole thread Raw
In response to can't seem to use index  (admin <admin@wtbwts.com>)
Responses Re: [GENERAL] Re: can't seem to use index
Re: [GENERAL] Re: can't seem to use index
List pgsql-general
Following a few suggestions, I have entered 2500 records in the
manufacturer table. Unfortunately, searching for name in the manufacturer
table still returned a sequential scan.

I then tried changing the btree index to a hash talbe and went through the
same procedure of vacumming and restarting a psql session. Yet again, the
index wasn't being used.

Finally, I decided to create an index for id as follows:
CREATE INDEX manu_id_idx ON "manufacturer" using btree ("id" "int2_ops");

Then, when trying a similar search on the id field, it used the index.
Unfortunately, I still can't seem to make postgresql use the index for
searching the name field.

Any other suggestions would be appreciated,
Marc

> I'm trying to use an index on a varchar(32) field, but explain keeps
> retuning a sequential scan. This is my table and index:
>
> CREATE TABLE manufacturer (
>   id int2,
>   name varchar(32)
> );
>
> CREATE INDEX manu_name_idx ON "manufacturer" using btree ( "name"
> "text_ops" );
>
> Both my table and index have been created successfully, and the database
> has been vacuumed. Then I run the following query from the psql
> command-line:
> explain select * from manufacturer where name='3COM';
>
> ... and I get a sequential scan! What gives?
>
> Any suggestions would be greatly appreciated,
> Marc
>
>
>


pgsql-general by date:

Previous
From: "Huynh, Long"
Date:
Subject: RE: [GENERAL] Intro/Win9X
Next
From: "William Goldsmith"
Date:
Subject: initdb error