X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5696DD1B967 for ; Mon, 8 Mar 2004 00:44:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 45935-05 for ; Sun, 7 Mar 2004 20:44:02 -0400 (AST) Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) by svr1.postgresql.org (Postfix) with ESMTP id 89092D1B8BC for ; Sun, 7 Mar 2004 20:43:58 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by bob.samurai.com (Postfix) with ESMTP id 452B51E03; Sun, 7 Mar 2004 19:44:01 -0500 (EST) Received: from bob.samurai.com ([127.0.0.1]) by localhost (bob.samurai.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 56631-01; Sun, 7 Mar 2004 19:43:59 -0500 (EST) Received: from samurai.com (d226-89-59.home.cgocable.net [24.226.89.59]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by bob.samurai.com (Postfix) with ESMTP id 5E1A01DD8; Sun, 7 Mar 2004 19:43:59 -0500 (EST) Message-ID: <404BC1CE.3040009@samurai.com> Date: Sun, 07 Mar 2004 19:43:58 -0500 From: Neil Conway User-Agent: Mozilla Thunderbird 0.5 (X11/20040304) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Steven Butler Cc: pgsql-performance@postgresql.org Subject: Re: Using bigint needs explicit cast to use the index References: <001101c404a3$fb34d320$fd08a8c0@steve> In-Reply-To: <001101c404a3$fb34d320$fd08a8c0@steve> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/91 X-Sequence-Number: 5947 Steven Butler wrote: > I've recently converted a database to use bigint for the indices. Suddenly > simple queries like > > select * from new_test_result where parent_id = 2 > > are doing full table scans instead of using the index. This is fixed in CVS HEAD. In the mean time, you can enclose the integer literal in single quotes, or explicitely cast it to the type of the column. FWIW, this is an FAQ. -Neil