From: Richard Huxton <dev@archonet.com>
To: terry@ashtonwoodshomes.com
To: Postgresql Sql Group (E-mail) <pgsql-sql@postgresql.org>
Subject: Re: FW: query optimization question
Date: Wed, 6 Nov 2002 15:11:22 +0000
Message-ID: <200211061511.22676.dev@archonet.com> (raw)
In-Reply-To: <002601c2859d$0d825480$2766f30a@development.greatgulfhomes.com>
References: <002601c2859d$0d825480$2766f30a@development.greatgulfhomes.com>
On Wednesday 06 Nov 2002 2:01 pm, terry@ashtonwoodshomes.com wrote:
> However, for the total deficiencies I am then splitting up the total into
> aging groups, eg <30, 30-60, 60-90, and >90 days old. The query for that
> looks like the below. But before I paste it in, I would like to optimize
> it, if I could do so with a group by clause I most certainly would, but I
> don't see how I can BECAUSE OF THE AGING BREAKDOWN:
[one sub-query per age-range]
> AND dt.days_old_start_date < {d '2002-10-07'}
> ) AS def_count_less_30,
> AND dt.days_old_start_date >= {d '2002-10-07'}
> AND dt.days_old_start_date < {d '2002-09-07'}
> ) AS def_count_30_60,
Could you not define a function age_range(date) to return the relevant range
text, then group on that text? I've used that before.
--
Richard Huxton
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: dev@archonet.com, terry@ashtonwoodshomes.com
Subject: Re: FW: query optimization question
In-Reply-To: <200211061511.22676.dev@archonet.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