Re: PostGres is not using indices in select, I would like

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Dominique Dumortier <dominique(dot)dumortier(at)entpe(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PostGres is not using indices in select, I would like
Date: 2001-09-27 21:46:41
Message-ID: Pine.BSF.4.21.0109271442470.22313-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 24 Sep 2001, Dominique Dumortier wrote:

> The table is created this way:
>
> CREATE TABLE "city" (
> "ciname" character varying(80),
> "cix" smallint,
> "ciy" smallint,
> "cilat" smallint,
> "cilong" smallint,
> "cialt" smallint,
> "cicocode" smallint,
> "cimacode" character(1),
> "cictcode" character(1)
> );
>
> COPY "city" FROM stdin;
> Abat 1030 504 4233 1981 1130 8 H T
> Abate 1030 504 4233 1981 1130 8 H T
> Abati 1030 504 4233 1981 1130 8 H T
> The table contains about 750000 lines such as the ones above.
>
>
> The index is created like that:
>
> CREATE INDEX ci_index on city (cix,ciy)
>
> If I do select ciname from city where cix=400 and ciy=500;

Ah, you're probably running into the integer constants being int4
problem. I'd suggest making the smallints into regular ints, or
explicitly casting the constants to smallint.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Arcady Genkin 2001-09-27 22:30:50 UNIQUE constraint and indexing
Previous Message Ian.Willis 2001-09-27 21:40:29 Re: My brain hurts - update field based on value of ano