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 1tjhMu-00Caef-Ab for pgsql-general@arkaria.postgresql.org; Sun, 16 Feb 2025 16:19:45 +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 1tjhMs-009Fng-B1 for pgsql-general@arkaria.postgresql.org; Sun, 16 Feb 2025 16:19:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tjhMq-009FnX-VD for pgsql-general@lists.postgresql.org; Sun, 16 Feb 2025 16:19:41 +0000 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tjhMo-0019Iz-0z for pgsql-general@postgresql.org; Sun, 16 Feb 2025 16:19:39 +0000 Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id D095913809C5; Sun, 16 Feb 2025 11:19:36 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Sun, 16 Feb 2025 11:19:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1739722776; x=1739809176; bh=hcys/cnIYP7BA4UQp9L0vF2uSU62t+rmmEo2ot+7DJw=; b= abTx2a1mcC06+5D5vc/vVPtbabkgbhOTuA0ikWDy1EhsizeOH6lZph/Q6wDzrhu7 fXylobSH8fFmwuWuJjmi+3fFVHb0wSAZHSzkCnDqawPHqT4zel/vNL41wNqwafy0 uK9L2KzHVhKgZOizU4AHDY8aINnWDgxwN2qyUcN2g7Npi/VNjdq1o+/6TsCX/qsG PdiykW2GPHERWgRbjdqYPEGeAUcizGsZBzYdAhqyhKN/FsM32U6Xdt+YjT+ILgsg lJwkd/uAN3SS3t7wqqqQmf9DRJlEAsAIy2lR3ZnIzxZGpjNTctbnRWRIJIPwQkUa JI4zE2j/beUYUFEg9qK2hw== 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 :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1739722776; x= 1739809176; bh=hcys/cnIYP7BA4UQp9L0vF2uSU62t+rmmEo2ot+7DJw=; b=H 72DZsE/PYOi9Iyl/uaa5b5Ri+nCzS3u2KyuU/aWk/7ys9+EwoJ39g7XzyDfefNdy 7X3yaWISXoS3T/9sj5Phqcff5cvr+eMQhfBoNMC2l6yKltJJaOJAApBKbxYydx1W qgvh80ZjHNNtdHT9nuaZDlz5f2nThYIjYaxIbUrq88r99xwk8EzPTEdp0uwnorQP YNiXVV4SH62m4gF6fL3o2tyAtxgk0f/76z64IS3NnC9GwIb6pYipzZh/YfuUBXWt GnGyT5kEdmZobDpGBLfW0wdj2G3h/nQnRDORc53Gm4PgW3tsTs4UWwWKkoKcM10D uca41XuMRT/jvBhuslWvQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdehheelfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgg gfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghv vghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrf grthhtvghrnhepgfdufeekhfevfeelveeiueevhedvuddukeduvddvlefhueeuieejtdeu vdevvdeunecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghv vghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopeegpdhmohguvgepshhmth hpohhuthdprhgtphhtthhopehmrghilhgsshhvseihrghhohhordgtohhmpdhrtghpthht ohephhhtrghmfhhiughssehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhhonhhljhhohh hnshhonhhjrhesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghr rghlsehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 16 Feb 2025 11:19:35 -0500 (EST) Message-ID: <6f44101c-ce01-478e-9fb1-138a10f358d9@aklaver.com> Date: Sun, 16 Feb 2025 08:19:35 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Help in vetting outcome of "vacuumdb --analyze-in-stages" - during DB Upgrade from EC2- PGS - Community Edn ver 13.X to 14.X To: Y_Bharani_mbsv , Greg Sabino Mullane , Ron Johnson Cc: pgsql-general References: <0558ddd4d71641bdb41fa49b2425f73c@safrangroup.com> <498dfb34-4dd7-4f48-8188-355e1488d7e6@aklaver.com> <1061066336.5835157.1733316137292@mail.yahoo.com> <1482982714.8486017.1735661703839@mail.yahoo.com> <1763130721.4001842.1737733841628@mail.yahoo.com> <132487461.4068668.1737741687606@mail.yahoo.com> <0dc06cb7-33cc-43ba-a95f-535fdf0a0439@aklaver.com> <1751608443.5432365.1738081421269@mail.yahoo.com> <74599d1d-c8a2-4e59-a50d-019dcc973de8@aklaver.com> <200665967.5560583.1738095230696@mail.yahoo.com> <21b5d62a-19d1-413f-9d5e-d681cd2bb91b@aklaver.com> <47454513.6047834.1738179914107@mail.yahoo.com> <1841861276.9581730.1738888679871@mail.yahoo.com> <56243553.9616888.1738893835649@mail.yahoo.com> <940531722.732202.1739711614045@mail.yahoo.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: <940531722.732202.1739711614045@mail.yahoo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/16/25 05:13, Y_Bharani_mbsv wrote: > Team > Good Morning. > As part of DB upgrade from EC2 - PGS - community Edn Ver 13.X to 14.X > I followed steps of "pg_upgrade" and had executed the last step (post > successful db migration) > > vacuumdb --analyze-in-stages > > and later noticed an caveat > url = https://www.postgresql.org/docs/current/app-vacuumdb.html > > > > |--analyze-in-stages| > > Only calculate statistics for use by the optimizer (no vacuum), like > |--analyze-only|. Run three stages of analyze; the first stage uses > the lowest possible statistics target (see default_statistics_target > ) to produce usable statistics faster, and subsequent stages build the full statistics. > > This option is only useful to analyze a database that currently has > no statistics or has wholly incorrect ones, such as if it is newly > populated from a restored dump or by |pg_upgrade|. *Be aware that > running with this option in a database with existing statistics may > cause the query optimizer choices to become transiently worse due to > the low statistics targets of the early stages.* Did you skip over reading this part?: "This option is only useful to analyze a database that currently has no statistics or has wholly incorrect ones, such as if it is newly populated from a restored dump or by pg_upgrade." > > > How to overcome the issue to avoid "transiently worse" > > > >   Later, I too did > a) vacuum(full,verbose,skip_locked) ... each table wise > b) analyze (verbose,skip_locked) .. each table wise > Any guidance > -- Adrian Klaver adrian.klaver@aklaver.com