pgsql: Perform less setup work for AFTER triggers at transaction start.

Поиск
Список
Период
Сортировка
Искать

pgsql: Perform less setup work for AFTER triggers at transaction start.

От:
Robert Haas <rhaas@postgresql.org>
Дата:
Perform less setup work for AFTER triggers at transaction start.

Testing reveals that the memory allocation we do at transaction start
has small but measurable overhead on simple transactions.  To cut
down on that overhead, defer some of that work to the point when
AFTER triggers are first used, thus avoiding it altogether if they
never are.

Patch by me.  Review by Andres Freund.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/2781b4bea7db357be59f9a5fd73ca1eb12ff5a79

Modified Files
--------------
src/backend/commands/trigger.c |  428 ++++++++++++++++++++++------------------
1 file changed, 232 insertions(+), 196 deletions(-)

Re: pgsql: Perform less setup work for AFTER triggers at transaction start.

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Robert Haas  writes:
> Perform less setup work for AFTER triggers at transaction start.

Perhaps I'm confused, but doesn't AfterTriggerEnlargeQueryState()
need to ensure there are at least query_depth + 1 entries in the
arrays?  Not just query_depth?

			regards, tom lane

Re: pgsql: Perform less setup work for AFTER triggers at transaction start.

От:
Robert Haas <robertmhaas@gmail.com>
Дата:
Вложения:
On Thu, Oct 23, 2014 at 1:57 PM, Tom Lane  wrote:
> Robert Haas  writes:
>> Perform less setup work for AFTER triggers at transaction start.
>
> Perhaps I'm confused, but doesn't AfterTriggerEnlargeQueryState()
> need to ensure there are at least query_depth + 1 entries in the
> arrays?  Not just query_depth?

Hmm, I think you're right.  Like this?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: pgsql: Perform less setup work for AFTER triggers at transaction start.

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Robert Haas  writes:
> On Thu, Oct 23, 2014 at 1:57 PM, Tom Lane  wrote:
>> Perhaps I'm confused, but doesn't AfterTriggerEnlargeQueryState()
>> need to ensure there are at least query_depth + 1 entries in the
>> arrays?  Not just query_depth?

> Hmm, I think you're right.  Like this?

Yeah, that's what I meant.

			regards, tom lane

FAQ