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 11EDE5287F for ; Sun, 22 May 2005 05:41:06 -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 34268-03 for ; Sun, 22 May 2005 08:40:54 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by svr1.postgresql.org (Postfix) with ESMTP id 2F5CA52882 for ; Sun, 22 May 2005 05:40:52 -0300 (ADT) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de with ESMTP (Nemesis), id 0MKwtQ-1DZm1c24Hv-0007fH; Sun, 22 May 2005 10:41:32 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.35 #1) id 1DZm2s-0001TI-00; Sun, 22 May 2005 10:42:50 +0200 Date: Sun, 22 May 2005 10:42:50 +0200 From: Andreas Kretschmer To: pgsql-sql@postgresql.org Cc: Andreas Kretschmer Subject: Re: [despammed] Balance Calculation Message-ID: <20050522084250.GA5579@webserv.wug-glas.de> Mail-Followup-To: Andreas Kretschmer , pgsql-sql@postgresql.org References: <033001c55e85$1801a730$1f00a8c0@middinks> <20050522081753.GA5136@webserv.wug-glas.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050522081753.GA5136@webserv.wug-glas.de> X-DEST: 208 X-MSMail-Priority: High X-Message-Flag: The Windows platform is not just insecure - it's patently, blatantly, and unashamedly insecure by design. X-PrivatMail: kretschmer@kaufbach.delug.de X-OS: Linux - weil ich es mir Wert bin! X-Info: registrierter Linux-User 97922 http://counter.li.org User-Agent: mutt-ng 1.5.9i (Linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.326 tagged_above=0 required=5 tests=AWL, MISSING_MIMEOLE, X_MSMAIL_PRIORITY_HIGH X-Spam-Level: X-Archive-Number: 200505/177 X-Sequence-Number: 21490 am 22.05.2005, um 10:17:53 +0200 mailte Andreas Kretschmer folgendes: > > can you help me how to fix them. > > Can I using function to fix them (how?) > > It is possible to create a extra table for the balance and a trigger for > insert/update that calculates the balance for the transactions-table? > > > I think, this should solve your perfomance-problem. Sorry, this is not the solution for your problem, because this provide only the actual balance for a single account, but not the history. Mmh... A extra table with the oid and the balance for every row in transactions. Then you can do a index scan, but you need also a trigger that insert every transaction in this table and calculate the balance. Regards -- Andreas Kretschmer (Kontakt: siehe Header) Heynitz: 035242/47212, D1: 0160/7141639 GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net === Schollglas Unternehmensgruppe ===