Re: Index usage question

From: "Mitch Vincent" <mvincent(at)cablespeed(dot)com>
To: "Norbert Zoltan Toth" <Norbert(dot)Zoltan(dot)Toth(at)cern(dot)ch>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index usage question
Date: 2001-09-04 19:13:25
Message-ID: 010e01c13575$ac109c20$1e51000a@mitch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The fastest operation for the number of rows returned by the query is
attempted -- granted that it may not always work but an index scan isn't
always the best answer for large sets of data..You actually have more
overhead using an index in some situations.

You said you enter some rows, but how many rows got returned by your query?

Though I'm not sure, PG might not treat that 1 as the integer 1, since it's
in single quotes.. The index was on an integer field, perhaps that is part
of the problem too...

-Mitch

> I have experienced the following problem, maybe they are related:
>
> I create a table with
> create table test (id int, name char(10));
>
> then I create an index on it with
> create index test_idx on test (id);
>
> After populating my table, the query
> select id from test where id='1';
>
> uses index scan.
>
> However when I only create the index AFTER inserting rows into the table,
> the index is not being used for the evaluation,
> even if I run vacuum / vaccum analyze on test;
>
> I would also appreciate some help with this.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2001-09-04 19:28:18 Re: urgently wanted - plpgsql.so for pg 6.4.2
Previous Message bpalmer 2001-09-04 19:12:17 Re: SHOW