Efficiency question: VARCHAR with empty string vs NULL

From: Doug Fields <dfields-pg-general(at)pexicom(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Efficiency question: VARCHAR with empty string vs NULL
Date: 2002-05-24 17:20:43
Message-ID: 5.1.0.14.2.20020524131720.02c09fa0@mail.pexicom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fran Fabrizio 2002-05-24 17:21:43 Re: Case Insensitive Data Type
Previous Message Darren Ferguson 2002-05-24 17:17:38 Re: Case Insensitive Data Type

Browse pgsql-sql by date

  From Date Subject
Next Message Gregory Brauer 2002-05-24 18:08:11 Trees in SQL
Previous Message Jeff Eckermann 2002-05-24 13:51:06 Re: Functions with dynamic queries