Re: Index usage question - Norbert - Mailing list pgsql-general

From Norbert Zoltan Toth
Subject Re: Index usage question - Norbert
Date
Msg-id 004b01c13590$8d14adf0$11278a89@cern.ch
Whole thread Raw
In response to Index usage question  (Jefim Matskin <mjefim@sphera.com>)
List pgsql-general
(Sorry for reposting...)

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

You're right, it does make all the difference.  With only a few rows,
indexing is somehow used in the first case only (for my example), but with
larger tables index scan is used in both ways.

Many thanks,
Norbert

>
> 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.
>
>
>


pgsql-general by date:

Previous
From: Jerry Asher
Date:
Subject: recovering a control file from a shutdown database....
Next
From: Jan Wieck
Date:
Subject: Re: FOREIGN KEY: difference between NOT DEFERRABLE and INITIALLY