pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: hargudekishor@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq
Date: Tue, 02 Aug 2016 15:30:42 -0400
Message-ID: <9511.1470166242@sss.pgh.pa.us> (raw)
In-Reply-To: <20160802180011.GA556096@alvherre.pgsql>
References: <20160802180011.GA556096@alvherre.pgsql>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (5+ messages)  latest in thread

Message-ID: <9511.1470166242@sss.pgh.pa.us>
Permalink:  ../9511.1470166242@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9511.1470166242@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, hargudekishor@gmail.com
  Subject: Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq
  In-Reply-To: <9511.1470166242@sss.pgh.pa.us>
  References: <20160802180011.GA556096@alvherre.pgsql> <9511.1470166242@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox