Efficiency question: VARCHAR with empty string vs NULL
Doug Fields <dfields-pg-general@pexicom.com>
From: Doug Fields <dfields-pg-general@pexicom.com>
To: pgsql-general@postgresql.org
Date: 2002-05-24T17:20:43Z
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