X-Original-To: pgsql-performance@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 55458926035 for ; Sat, 31 May 2003 14:12:42 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 15024-06 for ; Sat, 31 May 2003 14:12:31 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by developer.postgresql.org (Postfix) with ESMTP id 9B113926043 for ; Sat, 31 May 2003 14:12:31 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h4VICUU6021407; Sat, 31 May 2003 14:12:31 -0400 (EDT) To: Rod Taylor Cc: Brian Tarbox , Postgresql Performance Subject: Re: why Sequencial Scan when selecting on primary key of table? In-reply-to: <1054403470.11968.34.camel@jester> References: <004301c32791$f983c710$01000001@trouble> <21073.1054401227@sss.pgh.pa.us> <1054403470.11968.34.camel@jester> Comments: In-reply-to Rod Taylor message dated "31 May 2003 13:51:11 -0400" Date: Sat, 31 May 2003 14:12:30 -0400 Message-ID: <21406.1054404750@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/304 X-Sequence-Number: 2083 Rod Taylor writes: > Out of curiosity, why don't we confirm the unquoted value is an integer, > numeric, etc, then change it into type 'unknown'? UNKNOWNNUMERIC is one of the ideas that's been proposed, but it's not clear to me that it is better than other alternatives. In particular, I don't like losing knowledge of the form and size of the constant. Something like "WHERE int4col = 4.8" should yield FALSE, not "ERROR: pg_atoi: unable to parse '4.8'" which is what you're likely to get with a naive "unknown numeric type" approach. A perhaps-more-realistic objection is that it only solves the problem for trivial "var = const" cases. As soon as you look at even slightly more complicated expressions, it stops doing much good. I'm still of the opinion that the best solution in the long run is to get rid of most of the cross-datatype numeric operators, but there are pitfalls there too. See last thread on the issue: http://archives.postgresql.org/pgsql-hackers/2002-11/msg00468.php regards, tom lane