Re: Query design assistance - getting daily totals

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Paul Lambert" <paul(dot)lambert(at)reynolds(dot)com(dot)au>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Query design assistance - getting daily totals
Date: 2007-12-12 15:48:05
Message-ID: dcc563d10712120748t2ea3629fl9e9a578e00330f45@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Dec 12, 2007 12:39 AM, Paul Lambert <paul(dot)lambert(at)reynolds(dot)com(dot)au> wrote:
> A. Kretschmer wrote:
> > am Wed, dem 12.12.2007, um 10:34:35 +0900 mailte Paul Lambert folgendes:
> >> year_id integer
> >> month_id integer
> >> working_day integer
> >
> > Why this broken data types? We have date and timestamp[tz].
> >
> >
>
> It's a financial application which needs to work using a concept of
> 'financial periods' which may not necessarily correspond to calendar
> months and it's much easier to manage in this way than it is to merge it
> all together using a date field. Eg, 1st January may actually be the
> 15th 'working day' of the 9th 'financial period' - however looking at
> just a date of jan-1 there is no way of knowing this and it's the
> periods that matter more so than the actual date.

I'm not sure that really justifies your method though. Not saying
"you're doing it wrong" so much as I'm not sure the way you're doing
it makes it any easier to keep track of certain periods. Any method
you would use to pick rows with the disjointed dates could be applied
to date and / or timestamp types as easily, and with some functional
indexes on the date / timestamp columns you could easily select
periods quickly as well.

Just saying.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Gary Chambers 2007-12-12 16:58:20 Query Assistance
Previous Message Gerry Reno 2007-12-12 14:29:49 Re: join on three tables is slow