Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rptcF-009LtP-L4 for pgsql-novice@arkaria.postgresql.org; Thu, 28 Mar 2024 17:32:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rptcD-000V2z-Jy for pgsql-novice@arkaria.postgresql.org; Thu, 28 Mar 2024 17:32:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rptcD-000UyH-20 for pgsql-novice@lists.postgresql.org; Thu, 28 Mar 2024 17:32:37 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rptc9-0071zn-AO for pgsql-novice@lists.postgresql.org; Thu, 28 Mar 2024 17:32:36 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 5BE3D3200094; Thu, 28 Mar 2024 13:32:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 28 Mar 2024 13:32:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1711647149; x= 1711733549; bh=hTfQYE+39UMuyyDaVNAEbqzptox7PJ4sIsRu8A+4gog=; b=G J0pe3iKL0RzEqXFZkNt9CLD71Pgzdeaadt4UbDEFxcA6O8/1Gfm+SEQZdW3wNHkZ ORfERMJ1LuwgrVAjQJ6bf6Jh6RIFMUXxGT/9nX758eW6WfzdrPK52x0VItC4EQXy SSNdZkAnpWeHkMlWHAJ1DKfvKPlN0m2heGjFInkaOnMl8WXNfK5O2Txmo7dzNxLC WQZrhlux2bB23BC6vdXgw3xgNkHo9Iu4a6INQ9LLE47IoHbKuYC8u3nJ3KvYCNe1 2Q6US0WLZ7Q6IKbstBzC+rhz5kH3wMWn2vyN+si/fori7q2x/4z+h5zj/aP+v90T R8IBlr09nTE8Pb7jdtTfQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudduledguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeej keffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Mar 2024 13:32:28 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1711647146; bh=/VR1SKr1J4/pi60CnmKnqWpVjb6JgM+8vhFxejcqbD0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=RUHh+wyJz1C7Z880Yxfxz6ZuXTHjDUYG//Y837OCcWIEgGBZMaHhCrL+r5iGTGNfV tWUw9aDl7WTpoRNgrsEeaGOdn3+AP7S90TLOOzOSI6GIjVoqclX/tEc4YdLjyptThT /b4PpImrexqlSbiRrnNxFoe76FtCL0iiTUUyuPIscvqaGjZKnM1pCPd17C4r3O60Tk qlqWbHTqczvTslLz6cHopt9I60zLcYlUmmaLSQi4mjFzxeQUnGbYfe4EhEdnHVkoMv 9k6zv+v9CABizA0wo1dAJeWy1aimoIHEJUyFrjxvAWNHseqILOe7c11dztZeFc7sL9 z3onzxzBiUS8Q== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id E1E2D385; Thu, 28 Mar 2024 18:32:26 +0100 (CET) Date: Thu, 28 Mar 2024 18:32:26 +0100 From: Alvaro Herrera To: David Fogarty Cc: pgsql-novice@lists.postgresql.org Subject: Re: Performance after restart/reboot pre-Analyze Message-ID: <202403281732.p3cxllpbx7qf@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6F39634B-20B1-4683-9320-C4D7B68D53CF@icsusa.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Mar-28, David Fogarty wrote: > It seems like whenever I restart my database server performance is > quite bad until an Analyze has been performed. I expect this is due to > the query planner needing new stats, but that leads me to three > questions: How exactly are you restarting the database server? Statistics collected by ANALYZE are lost on crashes or when recovery is run, so if you're just hard-crashing your server, then ANALYZE is indeed necessary. If that's what's happening, try not doing that -- use fast shutdown (not immediate) and wait until it's finished before turning power off. If you do need to crash your server (but why risk your data?), then maybe vacuumdb --analyze-in-stages would be helpful. Otherwise, a cold cache as others mentioned is the most likely explanation. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Doing what he did amounts to sticking his fingers under the hood of the implementation; if he gets his fingers burnt, it's his problem." (Tom Lane)