X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6A6FD53585 for ; Wed, 20 Apr 2005 09:53:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63588-04 for ; Wed, 20 Apr 2005 12:53:09 +0000 (GMT) Received: from smtp-1.indo.net.id (smtp-1.indo.net.id [202.159.32.91]) by svr1.postgresql.org (Postfix) with SMTP id E8AEB53566 for ; Wed, 20 Apr 2005 09:53:00 -0300 (ADT) Received: (qmail 2562 invoked from network); 20 Apr 2005 19:52:58 +0700 Received: from smtp.indo.net.id (202.159.32.81) by smtp-1.indo.net.id with SMTP; 20 Apr 2005 19:52:58 +0700 Received: (qmail 26170 invoked from network); 20 Apr 2005 19:52:40 +0700 Received: from unknown (HELO middinks) (202.159.122.103) by smtp.indo.net.id with SMTP; 20 Apr 2005 19:52:40 +0700 Message-ID: <003f01c545a7$b7e3c5e0$1f00a8c0@middinks> From: "Muhyiddin A.M Hayat" To: "Christopher Browne" , References: <001c01c544ff$bb94d650$1f00a8c0@middinks> Subject: Re: Debet-Credit-Balance Calculation Date: Wed, 20 Apr 2005 20:50:48 +0800 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.399 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200504/300 X-Sequence-Number: 21193 > There is an easy way to do this; write a plpgsql set returning > function which adds the balance to the last column of the table. That > query will always have a cost in both time and memory proportional to > the size of the table, and the memory cost may bite you as table size > grows... > -- Can you give me some example function which adds the balance to the last column of the table. Thanks.