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 1m6Tf8-00052X-W0 for pgsql-general@arkaria.postgresql.org; Thu, 22 Jul 2021 08:02: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 1m6Tf6-0006wa-HV for pgsql-general@arkaria.postgresql.org; Thu, 22 Jul 2021 08:02: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 1m6Tf6-0006wR-7b for pgsql-general@lists.postgresql.org; Thu, 22 Jul 2021 08:02:32 +0000 Received: from mout0.freenet.de ([2001:748:100:40::2:2]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.92) (envelope-from ) id 1m6Tez-0002LQ-GH for pgsql-general@lists.postgresql.org; Thu, 22 Jul 2021 08:02:31 +0000 Received: from [195.4.92.122] (helo=sub3.freenet.de) by mout0.freenet.de with esmtpa (ID rissler.wolfgang@01019freenet.de) (port 25) (Exim 4.92 #3) id 1m6Tey-0001ie-75; Thu, 22 Jul 2021 10:02: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=MmLUP9Mnys0LF9bnG9MJakwjkLY3f+NA6eZiSvKDv1Q=; b=SnMU5+QkM7WW0zuzlAhK/NAZF2 8DYNB8eYYdMU6Lj3k8jQMnwiCHu3geY75hOrChreq9R3pYj5wlxN6yMUL1MGIV1L6TGYeaFLWX0NO qavhLM9D4586r4ddOwz5bu855T0pkqaB6tVPKnct4/aKp0W5fBV0jXbX3/WMz3O2ZX5UaOdH2ZKM3 Bp+dGO89shBjxWJ7OHombOEnrR2nL24zzafwG3sCLjln3S9HgHRvNoxBEnEqV6+MYDOP5qKDqyPQt vfZRmOttHFM5C06p5FDBG1V6/t2Tw6KWWN4cXV+rrpOyHn576DUVopheIN2EQRUDZhJnuln1DZVID +UlqM1eg==; Received: from p200300fc1f03f20071ae2cc52e779003.dip0.t-ipconnect.de ([2003:fc:1f03:f200:71ae:2cc5:2e77:9003]:55616) by sub3.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 1m6Tex-00049C-Os; Thu, 22 Jul 2021 10:02: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: <56345246-cd10-4b99-111f-46f4d48306a1@freenet.de> Date: Thu, 22 Jul 2021 10:02: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!55616 X-FNSign: v=2 s=094215DB0488A15641D7F1E47395090875498769DDCB7DF16389E92DFA22857C X-Scan-TS: Thu, 22 Jul 2021 10:02:23 +0200 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I also looked for the shutdown mode: since there is no -m parameter in the commandline for starting the windows-postgres-service, the shutdown mode seems to be the default: fast 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. > > -- May the source be with you