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.92) (envelope-from ) id 1j5vrC-0000Is-Rx for pgsql-admin@arkaria.postgresql.org; Sun, 23 Feb 2020 18:19:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j5vrA-0007rC-3G for pgsql-admin@arkaria.postgresql.org; Sun, 23 Feb 2020 18:19:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j5vr8-0007r1-6S; Sun, 23 Feb 2020 18:19:55 +0000 Received: from [64.147.123.25] (helo=wout2-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j5vr2-0008IR-89; Sun, 23 Feb 2020 18:19:52 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 93A565C2; Sun, 23 Feb 2020 13:19:36 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 23 Feb 2020 13:19:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=Q mjwwMy83Zk1opL4kwQWN1+/5qa0IDj4t0iEBpZnhq8=; b=KvgXhEjVS5d4OWfF3 qXomFMDHpROIXDctyMh+NWCVAuoc+Jk58zxXIh6IK000AyHyXy7p+RaOALXMYJB2 5icW9eqUT9gRcqWlah+s8kIx7WOS8s0GSnMvzX7dHFZc3sAfkuRBp4pFaiLPkezJ 47pX9rpwTgknPPDZVgNZryS+FOsUMD0W/zZsBMGx8i7MLotEoWBUWow6XJf4muk3 WQgaZvls+7TBeWnp0bGmI2OQXwB7upBcwZ7CvQQIOY2jJzxYsuGlutWyPA2BWu1i LZ942GnC8OeOzQ9ZzJhofXnRPQ8X8MMQNO1DDm/+wDwB6D/dFZwK1dpyQEWFnt8C wZwLA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm2; bh=QmjwwMy83Zk1opL4kwQWN1+/5qa0IDj4t0iEBpZnh q8=; b=VKmz/rBUdqZDmWCquDpCD0OYVr5zypNRi0d4RS1HFrtVZwEaloEgxmZb/ nKf6iWT6Txa777mYAqoxg4qZzf9ga0nfASsbniQO5EWGGmEEy2Jqskg9Pl5Ef2zh nK0b+ZqVmim9SJ+FWC3FSIplc+a5E9h+QaanR/9bJLlQS9S0flAE0bmA8dH5fICf mCBFSLkFDAgWgnHJtOak2nCr0ZRFTTsQUV3It2FwF3QEzZxBxBciwCA9diGaDZ1H Bzt6LEIAktFmkz3Ji9PR+r7Tc7zs/SMvN5l0GacymlEFWyZxDuTbnqCfo23h97gV Glw/q7gmuzi7DYtsXUHfDYCOx3J/Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrkeekgdduudduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecukfhppeejuddrvddu vddruddvledrudelfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id 962773060D1A; Sun, 23 Feb 2020 13:19:35 -0500 (EST) Subject: Re: Reset DB stats suggestion pg_stat_reset() To: postggen2020 s Cc: pgsql-general@postgresql.org, pgsql-admin@postgresql.org References: From: Adrian Klaver Message-ID: Date: Sun, 23 Feb 2020 10:19:34 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.25 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/22/20 6:40 PM, postggen2020 s wrote: > Thanks Adrian. > I am aware about the functions. Here need is, can we use this?.or is > there any known effects after firing the functions?. Yes the stats counters will be reset to 0, which means the planner will not have accurate statistics to work with. That can be corrected with an ANALYZE. The questions I have are: What is the issue you are trying to deal with? Also why do you think resetting the stats will fix it? > > Thanks, > Postgann. > > On Sat, Feb 22, 2020 at 10:47 PM Adrian Klaver > > wrote: > > On 2/22/20 12:26 AM, postggen2020 s wrote: > > Hi Team, > > > > Good Afternoon, > > > > We have seen some deadlocks and tempfile count in > pg_stat_database view. > > We are trying to reset the stats. > > Can we use pg_stat_reset() function to reset these stats without any > > impact stats of databases. > > Please advise the process to reset the stats. > > See here: > > https://www.postgresql.org/docs/12/monitoring-stats.html > > Table 27.20. Additional Statistics Functions > > It details what your options are. > > > > > Thanks. > > Postggen. > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com