Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group