X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 23B82D1B533 for ; Tue, 9 Sep 2003 15:18:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 17885-10 for ; Tue, 9 Sep 2003 12:18:27 -0300 (ADT) Received: from fuji.krosing.net (silmet.estpak.ee [194.126.97.78]) by svr1.postgresql.org (Postfix) with ESMTP id 514F9D1B521 for ; Tue, 9 Sep 2003 12:18:26 -0300 (ADT) Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id h89FIFmQ021677; Tue, 9 Sep 2003 18:18:20 +0300 Received: (from hannu@localhost) by fuji.krosing.net (8.12.8/8.12.8/Submit) id h89FI7pN021675; Tue, 9 Sep 2003 18:18:07 +0300 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: Need advice about triggers From: Hannu Krosing To: Mindaugas Riauba Cc: pgsql-performance@postgresql.org In-Reply-To: <00be01c376cf$91510620$f20214ac@bite.lt> References: <00be01c376cf$91510620$f20214ac@bite.lt> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1063120683.6150.43.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Tue, 09 Sep 2003 18:18:03 +0300 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/154 X-Sequence-Number: 3520 Mindaugas Riauba kirjutas T, 09.09.2003 kell 15:40: > Hello, > > I have small table (up to 10000 rows) and every row will be updated > once per minute. Table also has "before update on each row" trigger > written in plpgsql. But trigger 99.99% of the time will do nothing > to the database. It will just compare old and new values in the row > and those values almost always will be identical. > > Now I tried simple test and was able to do 10000 updates on 1000 > rows table in ~30s. That's practically enough but I'd like to have > more room to slow down. Is it 10000 *rows* or 10000*1000 = 10 000 000 *rows* updated ? When I run a simple update 10 times on 1000 rows (with no trigger, which you claim to take about the same time) it took 0.25 sec. > Also best result I achieved by doing commit+vacuum every ~500 > updates. It seems like you are updating more than one row at each update ? --------------- Hannu