pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Koczan <pjkoczan@gmail.com>
To: Chris Hoover <revoohc@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Help with database change
Date: Tue, 05 Jun 2007 18:36:26 -0500
Message-ID: <4665F37A.5040602@gmail.com> (raw)
In-Reply-To: <1d219a6f0706050633i47e9724ejc8e8dcc5dbeba2c8@mail.gmail.com>
References: <1d219a6f0706050633i47e9724ejc8e8dcc5dbeba2c8@mail.gmail.com>

Chris Hoover wrote:
> I am doing some research into partitioning my postgres database.  
> While doing this, I am trying to take the opportunity to improve the 
> over all database.design.  One of the things I am thinking of 
> implementing would be the use of nullif/coalesce.  Our application 
> tends to send a lot of strings that only contain spaces.  While I know 
> in the long run, the application needs to be fixed, I was thinking 
> about using nullif and coalesce so the database can just store nulls 
> in the database and save the space of storing "empty" strings as an 
> interim fix.
>
> My question is, how expensive is nullif and coalesce?  Can I expect to 
> see a noticeable impact on performance if I do this?
>
> Thanks,
>
> Chris
My gut would say that it's not very expensive, unless you're using very 
expensive regular expressions or already slow functions in expressions 
with nullif, coalesce.

However, you can always run tests yourself. Just generate a bunch of 
rows with dummy data and put them in a test database. There it's easy 
enough to benchmark nullif and coalesce on your own terms and see how 
much overhead they generate.

Peter



view thread (2+ messages)

Message-ID: <4665F37A.5040602@gmail.com>
Permalink:  ../4665F37A.5040602@gmail.com/
Also on:    postgresql.org/message-id/4665F37A.5040602@gmail.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-admin@postgresql.org
  Cc: pjkoczan@gmail.com, revoohc@gmail.com
  Subject: Re: Help with database change
  In-Reply-To: <4665F37A.5040602@gmail.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