X-Original-To: pgsql-sql@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 1CA3A926503 for ; Mon, 2 Jun 2003 14:30:15 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 55395-06 for ; Mon, 2 Jun 2003 14:30:03 -0400 (EDT) Received: from mail.rfc1149.net (marvin.enst.fr [137.194.161.2]) by developer.postgresql.org (Postfix) with ESMTP id EB4659264EA for ; Mon, 2 Jun 2003 14:29:30 -0400 (EDT) Received: from beeblebrox.rfc1149.net (beeblebrox-tun.enst.fr [137.194.161.40]) by mail.rfc1149.net (Postfix) with ESMTP id 17DAAA8063; Mon, 2 Jun 2003 20:29:29 +0200 (CEST) Received: by beeblebrox.rfc1149.net (Postfix, from userid 1000) id F2C3BE6; Mon, 2 Jun 2003 20:29:28 +0200 (CEST) Date: Mon, 2 Jun 2003 20:29:28 +0200 To: Richard Huxton Cc: pgsql-sql@postgresql.org Subject: Re: Maintaining a counter up-to-date References: <871xyc5vmw.fsf@inf.enst.fr> <200306021927.58636.dev@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200306021927.58636.dev@archonet.com> User-Agent: Mutt/1.4.1i From: Samuel Tardieu Organization: RFC 1149 (see http://www.rfc1149.net/) Reply-To: Samuel Tardieu Content-Transfer-Encoding: 8bit Precedence: special-delivery X-WWW: http://www.rfc1149.net/sam X-Mail-Processing: Sam's procmail tools X-Jabber: (see http://www.jabber.org/) X-OpenPGP-Fingerprint: 79C0 AE3C CEA8 F17B 0EF1 45A5 F133 2241 1B80 ADE6 (see http://www.gnupg.org/) X-Sam-Laptop: yes Message-Id: <2003-06-02-20-29-28+trackit+sam@rfc1149.net> X-Virus-Scanned: by amavisd-new X-Archive-Number: 200306/25 X-Sequence-Number: 13783 On 2/06, Richard Huxton wrote: | You want to use triggers not rules here (see the "server programming" and | "procedural language" manual sections). A trigger will be fired for each row | inserted/deleted/updated. Of course this means it will be fired 5000 times | for 5000 updated rows. Ouch. At the current time, I reverted to count(*) style which seems to be performed in much less time in 7.3.2 than in 7.2.x. I'll look at the triggers, thanks. Sam