From: Andrew J. Kopciuch <akopciuch@bddf.ca>
To: postgres@ied.com
To: pgsql-sql@postgresql.org
Subject: Re: switching default integer datatype to int8 and "IN (...)" clause
Date: Thu, 9 Jan 2003 03:30:41 -0700
Message-ID: <200301090330.41238.akopciuch@bddf.ca> (raw)
In-Reply-To: <no.Yo.N.nN.0301090355170.2533-100000@business.com>
References: <no.Yo.N.nN.0301090355170.2533-100000@business.com>
> but a select like this takes ages (looooong time):
> # select * from file where id = 1921773;
> id | name
> -----+----------------
> 1921777 | icons
>
I believe the reason is this : the numeric literal is first considered an int4
becuase it falls within the range of int4 (-2147483648 to +2147483647).
try quoting the literal like this:
# select * from file where id = '1921773';
This forces the literal to be evaluated. If you do an explain on that query
... you should see that the query planner uses the index as expected and that
the condition used on the index is using the literal value cast to a big int.
That's just my understanding anyway.
Andy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: akopciuch@bddf.ca, postgres@ied.com
Subject: Re: switching default integer datatype to int8 and "IN (...)" clause
In-Reply-To: <200301090330.41238.akopciuch@bddf.ca>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox