From: Adam Tauno Williams <awilliam@opengroupware.us>
To: pgsql-sql@postgresql.org
Subject: Re: short-cutting if sum()>constant
Date: Tue, 22 Dec 2009 09:02:37 -0500
Message-ID: <1261490557.6467.0.camel@linux-m3mt> (raw)
In-Reply-To: <20091222133527.3007bd96@dawn.webthatworks.it>
References: <20091222133527.3007bd96@dawn.webthatworks.it>
On Tue, 2009-12-22 at 13:35 +0100, Ivan Sergio Borgonovo wrote:
> Hi,
> I'd like to know if
> select sum(qty) from t where status=37;
> is > constant.
> qty is always >0.
> Is there a way to skip examining further rows and return a result
> ASAP?
SELECT SUM(object_version)
FROM date_x
WHERE owner_id = 10100
HAVING SUM(object_version) > 1000
?
--
OpenGroupware developer: awilliam@whitemice.org
<http://whitemiceconsulting.blogspot.com/;
OpenGroupare & Cyrus IMAPd documenation @
<http://docs.opengroupware.org/Members/whitemice/wmogag/file_view;
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: awilliam@opengroupware.us
Subject: Re: short-cutting if sum()>constant
In-Reply-To: <1261490557.6467.0.camel@linux-m3mt>
* 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