home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / database / informix / 1726 < prev    next >
Encoding:
Internet Message Format  |  1992-08-14  |  1.2 KB

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