performance with triggers depends on table size?

From: Christian Mock <cm(at)coretec(dot)at>
To: pgsql-general(at)postgresql(dot)org
Subject: performance with triggers depends on table size?
Date: 2002-08-12 17:06:32
Message-ID: 20020812170632.GA11183@notemock.coretec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hello,

I've got two identical tables, "input" and "output"; input is filled
by an importing process, the data is processed and partially deleted,
and the rest is copied to "output" by means of
INSERT INTO output SELECT * FROM input

What I noticed is that with triggers on the output table which update
a statistics table, the time needed for that copying is more or less
linearily dependant on the number of rows in the output table.

If I empty the triggered function (PL/pgsql), so the trigger fires but
doesn't update any tables, performance is about 60% of triggerless,
which is OK.

Also, both without a trigger and with the empty trigger, performance is
pretty much constant and doesn't depend on the size of the output table.

What I don't understand is how the size of the output table, which
is never used in the triggered function (except by the NEW alias)
can have such an extreme influence on the copying performance.

I made a small test case which is attached (perl/DBI) which demonstrates
this problem and displays the timings.

Regards,

cm.

--
Christian Mock Wiedner Hauptstrasse 15
Senior Security Engineer 1040 Wien
CoreTEC IT Security Solutions GmbH +43-1-5037273

Attachment Content-Type Size
trigger-perf.pl application/x-perl 2.4 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Copeland 2002-08-12 17:13:27 Re: [HACKERS] Linux Largefile Support In Postgresql RPMS\
Previous Message Greg Copeland 2002-08-12 16:53:06 Re: [HACKERS] Linux Largefile Support In Postgresql RPMS