Re: can't seem to use index

From: admin <admin(at)wtbwts(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: can't seem to use index
Date: 2000-01-10 18:07:07
Message-ID: Pine.BSF.4.10.10001101759580.54163-100000@server.b0x.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message The Hermit Hacker 2000-01-10 18:45:27 Re: [GENERAL] Intro/Win9X
Previous Message Patrick Welche 2000-01-10 16:19:53 Re: [GENERAL] can't seem to use index