X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A633547580B for ; Mon, 12 May 2003 19:50:24 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id EC279474E42 for ; Mon, 12 May 2003 19:50:23 -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 h4CNoOU6024827; Mon, 12 May 2003 19:50:24 -0400 (EDT) To: Stephan Szabo Cc: Josh Berkus , Ryan , pgsql-performance@postgresql.org Subject: Re: How are null's stored? In-reply-to: <20030512160355.L17085-100000@megazone23.bigpanda.com> References: <20030512160355.L17085-100000@megazone23.bigpanda.com> Comments: In-reply-to Stephan Szabo message dated "Mon, 12 May 2003 16:19:25 -0700" Date: Mon, 12 May 2003 19:50:24 -0400 Message-ID: <24826.1052783424@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-32.5 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/135 X-Sequence-Number: 1914 Stephan Szabo writes: > All in all, I'm not sure what the semantic differences between a varchar > with no length specified and a text are in PostgreSQL actually and if the > whole thing could be simplified in some way that doesn't break backwards > compatibility. Yeah, I've been wondering about that too. A large part of the problem is that varchar has its own set of operators, which the planner has no right to assume behave exactly like the text ones ... but they do. It might work to rip out the redundant varchar operators and allow indexes on varchar to become truly textual indexes (ie, they'd be text_ops not varchar_ops opclass). There might be a few tweaks needed to get the planner to play nice with indexes that require implicit coercions, but I think it could be made to work. Another idea that has been rattling around is to stop treating bpchar as binary-equivalent to text, and in fact to make bpchar-to-text promotion go through rtrim() to eliminate padding spaces. I think this stuff got put on hold because we haven't been able to come up with a good solution for the comparable problems in the numeric datatype hierarchy. But bpchar/varchar/text is a lot simpler problem, and maybe could be solved with the tools we have in place already. regards, tom lane