Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id BC0C3475FB4 for ; Fri, 24 May 2002 13:21:03 -0400 (EDT) Received: from a.mail.pexicom.com (a.mail.pexicom.com [64.125.181.59]) by postgresql.org (Postfix) with ESMTP id 86C9D475C2B for ; Fri, 24 May 2002 13:20:52 -0400 (EDT) Received: from vaio.dpf.cc ([209.10.243.34] helo=vaio.pexicom.com) by a.mail.pexicom.com with esmtp (SSLv3:DES-CBC3-SHA:168) (Exim 3.35 #1) id 17BIkG-00078D-00 for ; Fri, 24 May 2002 13:20:52 -0400 Message-Id: <5.1.0.14.2.20020524131720.02c09fa0@mail.pexicom.com> X-Sender: fields@mail.pexicom.com X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Fri, 24 May 2002 13:20:43 -0400 To: pgsql-general@postgresql.org From: Doug Fields Subject: Efficiency question: VARCHAR with empty string vs NULL In-Reply-To: <5589.1022165353@sss.pgh.pa.us> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Archive-Number: 200205/885 X-Sequence-Number: 24865 Hello, I have a table with about 15-20 VARCHAR items. I use VARCHAR on the assumption that it is more space efficient and not too much slower than CHAR, especially when you expect many of those VARCHAR to be null or empty strings. Is there a performance difference with VARCHAR elements of value NULL and zero-length string? If so, can I assume that NULL is the better performer, and thus re-code my INSERTS to replace empty strings with NULLs (or vice versa)? Now that I've had to re-write all my data to substring it to fit in the VARCHARs, one more "thing" won't matter much. Many Thanks, Doug