Re: short-cutting if sum()>constant - Mailing list pgsql-sql

From Adam Tauno Williams
Subject Re: short-cutting if sum()>constant
Date
Msg-id 1261490557.6467.0.camel@linux-m3mt
Whole thread Raw
In response to short-cutting if sum()>constant  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
List pgsql-sql
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>



pgsql-sql by date:

Previous
From: Filip Rembiałkowski
Date:
Subject: Re: short-cutting if sum()>constant
Next
From: "A. Kretschmer"
Date:
Subject: Re: short-cutting if sum()>constant