pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Doug Fields <dfields-pg-general@pexicom.com>
To: pgsql-general@postgresql.org
Subject: Efficiency question: VARCHAR with empty string vs NULL
Date: Fri, 24 May 2002 13:20:43 -0400
Message-ID: <5.1.0.14.2.20020524131720.02c09fa0@mail.pexicom.com> (raw)
In-Reply-To: <5589.1022165353@sss.pgh.pa.us>
References: <Pine.LNX.4.21.0205231506380.12663-100000@ponder.fairway2k.co.uk>
	<Pine.LNX.4.21.0205231506380.12663-100000@ponder.fairway2k.co.uk>

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




view thread (3+ messages)  latest in thread

Message-ID: <5.1.0.14.2.20020524131720.02c09fa0@mail.pexicom.com>
Permalink:  ../5.1.0.14.2.20020524131720.02c09fa0@mail.pexicom.com/
Also on:    postgresql.org/message-id/5.1.0.14.2.20020524131720.02c09fa0@mail.pexicom.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dfields-pg-general@pexicom.com, pgsql-general@postgresql.org
  Subject: Re: Efficiency question: VARCHAR with empty string vs NULL
  In-Reply-To: <5.1.0.14.2.20020524131720.02c09fa0@mail.pexicom.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox