Skip site navigation (1) Skip section navigation (2)

Re: Using null date fields to indicate active/expired records

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Brian Ghidinelli <brian(at)pukkasoft(dot)com>
Cc: sfpug(at)postgresql(dot)org
Subject: Re: Using null date fields to indicate active/expired records
Date: 2004-08-06 17:27:17
Message-ID: 200408061027.17012.josh@agliodbs.com (view raw or flat)
Thread:
Lists: sfpug
Brian,

> Approximately 14 billion.  Ok, I'm kidding, but can anyone answer my 
> question?  Although this might be micro-optimization, does it hurt to 
> know more about date performance?

No, there's nothing wrong with knowing.   What David and I are asserting is 
that your decision should be determined by having a correct data model, and 
not by counting bits, unless you're in a really extreme situation where you 
have already tested and know you have a problem.  

Josh's Database Rules #3: the performance loss for slow queries is generally 
exceeded by the downtime caused by a bad data model by a factor of 100 or 
more.

> There are two parts to my question; one, which is faster, and two, does 
> anyone have any advice about using either a single boolean flag or using 
> a 1-n type date?

Which is faster depends on your query structure and the distribution of your 
data; that's the other reason not to make decisions on this basis now.  If 
you want a serious answer on this, please post your current table structure 
and an explanation of what kind of data is kept in the various fields and how 
you query it.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


In response to

Responses

sfpug by date

Next:From: David FetterDate: 2004-08-06 19:08:53
Subject: Re: Using null date fields to indicate active/expired records
Previous:From: Josh BerkusDate: 2004-08-06 16:15:47
Subject: Re: Using null date fields to indicate active/expired records

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group