Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ijnHL-0001bL-1t for pgsql-general@arkaria.postgresql.org; Tue, 24 Dec 2019 16:43:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ijnHJ-0007ZC-S1 for pgsql-general@arkaria.postgresql.org; Tue, 24 Dec 2019 16:43:25 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1ijnHJ-0007Z5-Hk for pgsql-general@lists.postgresql.org; Tue, 24 Dec 2019 16:43:25 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ijnHD-0005wJ-Bb for pgsql-general@postgresql.org; Tue, 24 Dec 2019 16:43:23 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 462A421F18; Tue, 24 Dec 2019 11:43:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 24 Dec 2019 11:43:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=3 SCUN2ouYWwyfUGZbLd8tqkvH7uOny5kjdskYKxIj78=; b=lZc+x7q3bFQMftQOb 0MiiN/hJ1m4JojCjITAHVl2RKbH6uoyLmr1becal6aoOIWvLi2wcwkaVcSteNyCp vGrgFTZF7KMopRR7lew30vXq4KaS4LJKPuzdqI4pTSjAjygzHdPPfBfQbCtSDLx1 Sjd1KLsm4vDbXrOvqSfpKrNotNKcOQdNRjYXzcsuaT83Fi/qjG7daXgX2TDzIilB owzMrcDkaf2zt6Q7CYJCEi3Nf3YGYjUq7/Ex2WDT3p95qIIk2dwuW1egj2AqbV+j eTX0omBRtXJKINyh7ETRnrUuuujuze5f484q1iSWBKPiJGNGvprcKrs5J/Ebv7ac AQf6g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=3SCUN2ouYWwyfUGZbLd8tqkvH7uOny5kjdskYKxIj 78=; b=FLpCQs/ZiMtcCS53oXT5FsFcb7NidVGQMuDUOHXk6SDAvbqeSys3V1zRc rZjDVgyQNnOg0y0X+R8s6CVwhlhUGo94fcNynPNpUGSCPLOWxwo+JWQ+vsFj/Nef BwRr+USnDOsxbm+JT0iHWD0Vuc1rkUQwu2haOL6Q8gEAQwbk+vhAg/7RnziWRi2x u7UuOtqPacRw3uKVyFJSSDAOLRUu3LWX8BStIN5qGxT/6IsZlFwFbMP9CdVGojzT Mmfv2t892mZlSqNKyHlKnlYE1LlfuUD5kioMdjidtW0k03/R9084Hha6RF284e3B qW5s+Buhm693jokw8M3BKnkcMhSlQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddvvddggeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfeehnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuffhomhgrihhnpehpohhsthhgrhgvsh hqlhdrohhrghenucfkphepjedurddvuddvrdduvdelrdduleefnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmnecuve hluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.2] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id 676728005C; Tue, 24 Dec 2019 11:43:16 -0500 (EST) Subject: Re: Postgres cursor taking 2 hrs to update the table To: M Tarkeshwar Rao , "'pgsql-general@postgresql.org'" References: From: Adrian Klaver Message-ID: Date: Tue, 24 Dec 2019 08:43:15 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/24/19 2:32 AM, M Tarkeshwar Rao wrote: > Hi, > > I have the 10 application processes(each process having 12 threads and > each of have updating 8 million rows in the shared memory) which are > reading the data from single postgres database. We are using database > cursors in C++ to fetch the data and updating the shared memory. There > is the timer attached, where all the processor threads going to fetch > the data. > > The issue is that sometimes it is fetching all the data in few seconds > and sometimes it is taking 2 hrs. > > /What could be the issue. Can you please guide me to resolve the issue?/ By providing more information: 1) Postgres version? 2) OS and version? 3) Where the client and server are relative to each other? 4) Any relevant information from the Postgres log? You might also look at: https://www.postgresql.org/docs/11/auto-explain.html > > Regards > > Tarkeshwar > -- Adrian Klaver adrian.klaver@aklaver.com