trigger SPI_exec count argument

From: Michael Nacos <m(dot)nacos(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: trigger SPI_exec count argument
Date: 2009-09-02 12:21:05
Message-ID: 407fa4640909020521q72e71e60o923bc5e991a6009f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I have been trying to improve the performance of a C trigger only to notice
that the real bottleneck was the SPI execution of dynamic SQL statements. I
had been using SPI_exec(sql,0) until I tried SPI_exec(sql,1), since I am
targeting exactly one row each time for writing. This simple change has made
a huge difference (2s --> 60ms in some cases), now the trigger execution
time is consistent with the response times I get if I run the same SQL
statements by hand in psql. I am happy my code performs better, but is this
something you would expect?

regards, Michael

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2009-09-02 13:55:36 Re: remove flatfiles.c
Previous Message Merlin Moncure 2009-09-02 12:07:13 Re: Adding \ev view editor?