Trigger function in a multi-threaded environment behavior - Mailing list pgsql-hackers

From Hardik Belani
Subject Trigger function in a multi-threaded environment behavior
Date
Msg-id AANLkTilySnCvFjNTsnRPazv7nyep_Pa1wx7Wa2j9YhqE@mail.gmail.com
Whole thread Raw
Responses Re: Trigger function in a multi-threaded environment behavior  (Peter Eisentraut <peter_e@gmx.net>)
Re: Trigger function in a multi-threaded environment behavior  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
 
We have a multi-threaded environment in linux where multiple threads are performing database operations(insert, update, select and at times delete as well) in transaction mode (which may span across stored

procedures) using unixodbc. Now this as is, works fine.

 

If we introduce postgres triggers (trigger functions) on some of the tables to track insert/update/delete operations, (This is done by keeping and updating a counter field for every insert, update and delete operation performed on a set of tables inside trigger function) at this point, one or more threads get stuck in lock while executing the query, to the extent that sometimes even with the pgadmin, the database tables cannot be updated.

 

We are using postgres v8.4 and unixodbc v2.2.14.

 

Here in this case when using postgres triggers in a multithreaded application, do we have to take care of table/row level locks inside trigger function.

 

Thanks,

Hardik

 

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Keepalive for max_standby_delay
Next
From: Peter Eisentraut
Date:
Subject: Re: Trigger function in a multi-threaded environment behavior