X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id ABB75D1B456 for ; Tue, 9 Dec 2003 21:46:18 +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 26060-05 for ; Tue, 9 Dec 2003 17:45:49 -0400 (AST) Received: from curie.credativ.org (credativ.com [217.160.209.18]) by svr1.postgresql.org (Postfix) with ESMTP id BE40FD1B442 for ; Tue, 9 Dec 2003 17:45:46 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by curie.credativ.org (Postfix) with ESMTP id 94D59562C8; Tue, 9 Dec 2003 22:45:48 +0100 (CET) Received: from 192.168.2.126 (dsl-213-023-254-243.arcor-ip.net [213.23.254.243]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by curie.credativ.org (Postfix) with ESMTP id EA41756271; Tue, 9 Dec 2003 22:45:47 +0100 (CET) From: Peter Eisentraut To: "David B" , Subject: Re: Faster performance when using where cust_id = '123' vs cust_id = 123. Does 7.4 fix this?? Date: Tue, 9 Dec 2003 22:45:46 +0100 User-Agent: KMail/1.5.4 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200312092245.46122.peter_e@gmx.net> X-Virus-Scanned: by AMaViS X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/74 X-Sequence-Number: 16240 David B wrote: > We have got used to the problem that queries of the format: > > select * > from customer > where cust_id = '123' are much much faster than > > select * > from customer > where cust_id = 123 > > (where cust_id is defined as bigint). > > a. Why is this. Because in the second case, the 123 gets resolved too early to type integer, which is not index compatible with type bigint. > b. Will moving to v7.4 change this so we can avoid the whole '123' > casting thing. No, but 7.5 will be able to handle it.