Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6CXW-0006ym-6p for pgsql-general@arkaria.postgresql.org; Wed, 21 Jul 2021 13:45:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m6CXU-0004PK-DL for pgsql-general@arkaria.postgresql.org; Wed, 21 Jul 2021 13:45:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6CXU-0004PB-2Q for pgsql-general@lists.postgresql.org; Wed, 21 Jul 2021 13:45:32 +0000 Received: from mout2.freenet.de ([2001:748:100:40::2:4]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6CXR-0001Hm-BT for pgsql-general@lists.postgresql.org; Wed, 21 Jul 2021 13:45:31 +0000 Received: from [195.4.92.120] (helo=sub1.freenet.de) by mout2.freenet.de with esmtpa (ID rissler.wolfgang@01019freenet.de) (port 25) (Exim 4.92 #3) id 1m6CXM-0009BI-Nj; Wed, 21 Jul 2021 15:45:24 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freenet.de; s=mjaymdexmjqk; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=dS9EpaizAEiHUG3oxqPyux9FuPeVOPL3kkOjNzpLsQ4=; b=aMDIQxEf//SWnF9fdPXTjJsGlT Opao9rWevha2LPB/LJbqtzQLAt1PRNXjpCbxbTUaZcVr87CyzsxthBVRDh2wz/7Wq5XCrO8kkNRPw SP7fAZ4R7mla+hr7yk+F71PyB/xMYfwC2Kn1YxdFdEg+3k5ceS1vN69/vsCuoeDuGXaQjCwqkL0O9 lBRYTR7nRc1XS3fgg/yMUwpiMWJcVRGwq1rWEeKdOHiGsKBof4C7HBaNXJ1CETQ3KnDcKTDm0vQJA I2naVBrRugbftSC9Klp1TyVbRn1ZxTXUFDrAsGD2SIo4/fKPF8vJEyy0Rhv1oz7y9OF5RIvd9canB 9ruAxS4w==; Received: from p200300fc1f03f20071ae2cc52e779003.dip0.t-ipconnect.de ([2003:fc:1f03:f200:71ae:2cc5:2e77:9003]:52217) by sub1.freenet.de with esmtpsa (ID rissler.wolfgang@01019freenet.de) (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (port 465) (Exim 4.92 #3) id 1m6CXM-0000hW-LT; Wed, 21 Jul 2021 15:45:24 +0200 Subject: Re: Obsolete or dead serverconnections after reboot To: Vijaykumar Jain Cc: pgsql-general References: <9da9e765-9042-4f5e-00a1-4695d1244a47@freenet.de> From: WR Message-ID: <32bb4b13-2ec1-91c6-4e1f-efa51cfd25c0@freenet.de> Date: Wed, 21 Jul 2021 15:45:23 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 8bit X-Originated-At: 2003:fc:1f03:f200:71ae:2cc5:2e77:9003!52217 X-FNSign: v=2 s=162EACD8148E9D6A8E8AFB187D066CEC9C37058D6B13AB4E91B15E2B5FF8B9CB X-Scan-TS: Wed, 21 Jul 2021 15:45:24 +0200 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Vijaykumar Jain, thank you for fast answer, today I'm not able to access the hardware, I'll be back tomorrow and will do the required tests. Wolfgang Am 21.07.2021 um 15:14 schrieb Vijaykumar Jain: > select pg_stat_reset(); > > Can you run above function, to check if stats are reset and things are > fine without a pg restart? > I not able to understand how new connection stats are added, along with > old stale states, if I assume stats collector process is having issues , > or the stats folder is corrupt etc. > That would also mean, all table stats would be off or not updated too? > Is that so? Or analyse works fine on tables without a restart? > > On Wed, Jul 21, 2021, 6:27 PM Vijaykumar Jain > > wrote: > > > > Is there a way to avoid this (without restarting the service > after every > reboot). Is this a bug or a normal behavior? > > > I have less knowledge of windows. > https://www.enterprisedb.com/blog/postgresql-shutdown > > > > > Do you see shutdown/termination messages in the db logs or windows > event logs when the machine is rebooted? > > You get the same pid and query, does it also has the same age( time > since it started), > I mean is the stats table updated with new data for stale > connections or they remain static. > > Do you see the same issue when the machine is power cycled. > > Maybe windows might be preserving the memory state on disk and > reading it back on reboot (like sleep) unless there are instructions > to shutdown the db server on reboot. Idk. > > What are the state of the connections in pg_stat_activity abd > process explorer before and after reboot. The sockets exists and > active,  or are residual in pg stats only. > >