Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq
Date
Msg-id 9511.1470166242@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-bugs
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> hargudekishor@gmail.com wrote:
>> We have connected our node js application with postgresql-9.4.8.We have
>> several functions which are getting created in database using async call
>> from nodejs to postgresql server.but while creating those functions ,We are
>> encountered a error of "Tuple concurrently updated".

> Yeah, this is known.  We haven't worried too much, because the use case
> seems thin: why are you deleting and creating the function over and
> over?  Wouldn't it be better to create the function once and be done
> with it?

Note that each one of those create calls, before failing, will have had
to wait for the previous updater to commit or not.  We could imagine
installing alternate behavior such as "don't fail if the new state of the
pg_proc row is exactly what you wanted anyway"; but I do not see any
useful semantics that would not involve waiting to see if the prior
transaction commits.  And then there's the cost of the bloat that you're
creating in the pg_proc catalog.  So quite aside from the possibility of
a concurrent-update failure, you'd be much better off from a performance
standpoint if you take the trouble to not repetitively create the same
function.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: BUG #12884: configure script fails on a platform with /tmp directory read only
Next
From: Thomas Munro
Date:
Subject: Re: BUG #13810: cursor_to_xml ignores tableforest parameter