Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6BDF147595A for ; Thu, 9 Jan 2003 05:30:49 -0500 (EST) Received: from MAIL.nucleus.com (mail.nucleus.com [207.34.93.23]) by postgresql.org (Postfix) with ESMTP id BCFAC4758C9 for ; Thu, 9 Jan 2003 05:30:48 -0500 (EST) Received: from dsl-mr-209-115-166-163-cgy.nucleus.com (unverified [209.115.166.163]) by MAIL.nucleus.com (Vircom SMTPRS 2.0.240) with ESMTP id ; Thu, 9 Jan 2003 03:30:50 -0700 From: "Andrew J. Kopciuch" Reply-To: akopciuch@bddf.ca Organization: BDDF Consulting To: postgres@ied.com, pgsql-sql@postgresql.org Subject: Re: switching default integer datatype to int8 and "IN (...)" clause Date: Thu, 9 Jan 2003 03:30:41 -0700 User-Agent: KMail/1.5 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200301090330.41238.akopciuch@bddf.ca> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/118 X-Sequence-Number: 10983 > 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