Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUfOr-0005I0-BG for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Aug 2016 19:30:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bUfOq-00016p-TK for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Aug 2016 19:30:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bUfOq-00016N-3g for pgsql-bugs@postgresql.org; Tue, 02 Aug 2016 19:30:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bUfOn-00018C-4o for pgsql-bugs@postgresql.org; Tue, 02 Aug 2016 19:30:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u72JUgXN009512; Tue, 2 Aug 2016 15:30:42 -0400 From: Tom Lane To: Alvaro Herrera cc: hargudekishor@gmail.com, pgsql-bugs@postgresql.org Subject: Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq In-reply-to: <20160802180011.GA556096@alvherre.pgsql> References: <20160802180011.GA556096@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 02 Aug 2016 14:00:11 -0400" Date: Tue, 02 Aug 2016 15:30:42 -0400 Message-ID: <9511.1470166242@sss.pgh.pa.us> X-Pg-Spam-Score: -3.1 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Alvaro Herrera 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