Re: Touch row ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Eric B(dot)Ridge" <ebr(at)tcdi(dot)com>
Cc: Mike Mascari <mascarm(at)mascari(dot)com>, NTPT <ntpt(at)centrum(dot)cz>, PostgreSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Touch row ?
Date: 2004-01-24 17:18:53
Message-ID: 3674.1074964733@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-general

"Eric B.Ridge" <ebr(at)tcdi(dot)com> writes:
> [ update timestamp via a rule ]
> explain analyze update foo_view set id = 1 where id = 1;
> Average runtime for 10 executions: 0.165ms
> [ update timestamp via a trigger ]
> explain analyze update foo2 set id = 1 where id = 1;
> Average runtime for 10 executions: 0.328ms

This surprises me. There's a moderate amount of overhead involved in
a plpgsql trigger, but I'd not have thought it would swamp the added
inefficiencies involved in a rule. Notice that you're getting a double
indexscan in the rule case --- that takes more time to plan, and more
time to execute (observe the nearly double actual time for the top level
plan node).

What were you averaging here --- just the "total runtime" reported by
EXPLAIN ANALYZE? It would be interesting to factor in the planning time
too. Could you retry this and measure the total elapsed time? (psql's
\timing command will help.)

regards, tom lane

In response to

Responses

Browse pgsql-announce by date

  From Date Subject
Next Message Tom Lane 2004-01-24 19:34:58 Re: Touch row ?
Previous Message Doug McNaught 2004-01-24 14:11:39 Re: Touch row ?

Browse pgsql-general by date

  From Date Subject
Next Message Andreas 2004-01-24 17:49:07 Is there something like an dynamic view ?
Previous Message Joshua D. Drake 2004-01-24 17:08:30 Re: pl/pgsql docs 37.4.3. Row Types -- how do I use this