Re: [GENERAL] can't seem to use index

From: Aaron Holtz <aholtz(at)bright(dot)net>
To: admin <admin(at)wtbwts(dot)com>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] can't seem to use index
Date: 2000-01-10 04:01:28
Message-ID: Pine.LNX.4.10.10001092259510.7322-100000@blacker-cable.bright.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I believe that vacuuming the database will help the system determine
whether a sequential scan or an index scan is more efficient. It's much
faster for the db to scan sequentially when only a few records exist in
the db. Copy in a chunk of data, vacuum and then rerun your explain.
Sometimes I've had to \q and reconnect to the db to get it to use the
index on an explain, but that could just be coincidence.

--------------------------------------------------------------------------
Aaron Holtz
ComNet Inc.
UNIX Systems Administration/Network Operations
"It's not broken, it just lacks duct tape."
--------------------------------------------------------------------------

On Jan 9, admin molded the electrons to say....

>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 Tom Lane 2000-01-10 04:35:40 Re: [ANNOUNCE] Searching http://www.postgresql.org ...
Previous Message Ed Loehr 2000-01-10 02:53:51 Re: [GENERAL] Re: referential integrity (fwd)