pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Help with database change
2+ messages / 2 participants
[nested] [flat]

* Help with database change
@ 2007-06-05 13:33  Chris Hoover <revoohc@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Chris Hoover @ 2007-06-05 13:33 UTC (permalink / raw)
  To: pgsql-admin

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

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Help with database change
@ 2007-06-05 23:36  Peter Koczan <pjkoczan@gmail.com>
  parent: Chris Hoover <revoohc@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Koczan @ 2007-06-05 23:36 UTC (permalink / raw)
  To: Chris Hoover <revoohc@gmail.com>; +Cc: pgsql-admin

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-06-05 23:36 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-06-05 13:33 Help with database change Chris Hoover <revoohc@gmail.com>
2007-06-05 23:36 ` Peter Koczan <pjkoczan@gmail.com>

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