home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!decwrl!oracle!pyramid!infmx!news
- From: cortesi@informix.com (David Cortesi)
- Newsgroups: comp.databases.informix
- Subject: Re: conditional select sum() based on field question
- Message-ID: <1992Aug14.193931.28470@informix.com>
- Date: 14 Aug 92 19:39:31 GMT
- References: <9305@emory.mathcs.emory.edu>
- Sender: news@informix.com (Usenet News)
- Reply-To: cortesi@informix.com
- Organization: Informix Software, Inc.
- Lines: 18
-
- In article <9305@emory.mathcs.emory.edu> A.Heskett@bnr.co.uk (Tony Heskett)
- writes:
- >
- > Pete Frehner writes:
- >
- > > [ ... add or subtract according to record type, only scan table once ... ]
- >
- > Call me stupid (go on, I'm waiting :-) but why don't you just
- > do this ? Is a cursor *much* slower ?
- >
- [fetch-loop to scan table adding and subtracting amounts, omitted]
-
- You ain't stupid (at least on present evidence :-) but a cursor
- ought to be slower for this problem. Reason: your cursor
- scan requires passing every row from the engine to the program.
- Each trip back and forth between engine and application costs
- time. Any solution that has the engine calculate the sum should
- be faster because less stuff is shoved through the pipes.
-