From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: Query design assistance - getting daily totals
Date: Wed, 12 Dec 2007 07:31:42 +0100
Message-ID: <20071212063142.GA26523@a-kretschmer.de> (raw)
In-Reply-To: <475F3AAB.2050609@reynolds.com.au>
References: <475F3AAB.2050609@reynolds.com.au>
am Wed, dem 12.12.2007, um 10:34:35 +0900 mailte Paul Lambert folgendes:
> I have a table of account balances as at the end of a working day and
> want to from that, calculate daily total figures.
>
> Eg, let's say I have a table structure of:
> year_id integer
> month_id integer
> working_day integer
Why this broken data types? We have date and timestamp[tz].
> I suspect the second option would be more efficient than the first, and
> probably easier to implement since it would be easier to handle
> cross-month boundaries, i.e. day 1's daily total will be the amount on
> that day minus the amount of the final day in the previous month - but
> does anyone have any alternate suggestions that would be better still?
Yes, i would also write a similar function. And if you have proper
datatypes it would be simpler to calculate the previous date and you can
use a proper index on the date column.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
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-sql@postgresql.org
Cc: andreas.kretschmer@schollglas.com
Subject: Re: Query design assistance - getting daily totals
In-Reply-To: <20071212063142.GA26523@a-kretschmer.de>
* 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