Re: PostGres is not using indices in select, I would like it to because it is too slow ! - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: PostGres is not using indices in select, I would like it to because it is too slow !
Date
Msg-id 20010928093303.C32426@svana.org
Whole thread Raw
In response to PostGres is not using indices in select, I would like it to because it is too slow !  (Dominique Dumortier <dominique.dumortier@entpe.fr>)
List pgsql-general
On Mon, Sep 24, 2001 at 09:39:19PM +0200, Dominique Dumortier wrote:
> Dear all,
>
>     "cix" smallint,
>     "ciy" smallint,

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

Try putting quotes around the numbers. There are similar issues with bigint
where it can't see that smallint promotes to int4 without loss so it doesn't
realise that it can use an index.. By putting quotes around it, the database
will see them as smallints and (hopefully) us the index.

HTH,

--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> Magnetism, electricity and motion are like a three-for-two special offer:
> if you have two of them, the third one comes free.

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Performance question (stripped down the problem)
Next
From: merlyn@stonehenge.com (Randal L. Schwartz)
Date:
Subject: Re: Randomize Result Set Order