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 1lSDtb-0007et-Fy for pgsql-general@arkaria.postgresql.org; Fri, 02 Apr 2021 07:07:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lSDtZ-0001sT-0c for pgsql-general@arkaria.postgresql.org; Fri, 02 Apr 2021 07:07:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lSDtX-0001sL-Ve for pgsql-general@lists.postgresql.org; Fri, 02 Apr 2021 07:07:04 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lSDtV-0001qO-5Z for pgsql-general@lists.postgresql.org; Fri, 02 Apr 2021 07:07:02 +0000 Received: by mail-wr1-x433.google.com with SMTP id j9so3910795wrx.12 for ; Fri, 02 Apr 2021 00:07:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=7qo7FKoud7rr0yu+QbM0s1ajpTvpVwWVG8KL1/xeHLw=; b=kNxzCqEPN1DDfFRQl7kjveAj+auTHCO4HiconrVctLCbEz87nMgESPpKOft8YyxnWD brgCGyYWKddj8Nv4hminhpEAQFAhbky3PnmtGxHRz+lvTexyJdpSaj0rDsqV57HokkOJ 1RLF/2tpRrl/XRe2MYjILmuFQIc3VCTatStuhsyHlnio1VUYK9MODd2W9Wo+IbCEJYfo qtoYVobfm8dW5ea6+IsI7SicXS4SrAAV6aEXlvtxmFhcdfpzlRTSXxwYXbZYobeVqhSB fkuC9Po+VYlXgP3UYPULn5b/yIojSegaDPcy1CD2/DisGkvK1ZfIHXUGBDSsPueHf+se 2f5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=7qo7FKoud7rr0yu+QbM0s1ajpTvpVwWVG8KL1/xeHLw=; b=YgYtCDK10wejNK1+nqP0T4MNi62GXcSAJ5wXjIa0EctScLCTp5WqIptMNSlsBISCd4 afF1qSXVKLKQMex7uFFnRinIrEJaTC0ZBw0Ec7WwOoYOPbEPNoRJhxbeDyKB75N94Xa2 ppG6+lmPpQodOMhG/ZzdClCnTHDGRPrL6dSzcaK0rNe46mo6hJFtvBFMHrHdZtM8DZYw YLAEEAXSEJGppQCWaYiUPJ1QW1aiKjQ+p7QGBPAdksO0HM9TB05VNb+EBSGDkchuqy8n z0yo3Fvdk1Z/3jCVqz+TRpDBtVYncqGrJTgMkEL+glGQDXSkUpdAe/0uy95wIdwBKe2U ofuw== X-Gm-Message-State: AOAM530aSOWfoCwCWc9/gI/V1rvVehj55vlzt6Jou8czYDrd3+RdefPz Luke+8NZ+Ah52fiLUix8km8AsfHd8jA= X-Google-Smtp-Source: ABdhPJyiRcdl/g/xCCTbS7K0X29hWTs6LrqZOlWkZFp1uylMZUNGwquSFiQKiOnuthAwVL5bIPqsxw== X-Received: by 2002:a5d:6152:: with SMTP id y18mr13837885wrt.255.1617347219726; Fri, 02 Apr 2021 00:06:59 -0700 (PDT) Received: from co7vb01.localdomain ([2a01:e0a:22d:4d0:5604:a6ff:fea1:af7e]) by smtp.gmail.com with ESMTPSA id n9sm13342595wrx.46.2021.04.02.00.06.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Apr 2021 00:06:59 -0700 (PDT) Subject: Re: Copy Statistics Tables During Upgrade To: pgsql-general@lists.postgresql.org References: <1042003030.2667942.1617214523822.ref@mail.yahoo.com> <1042003030.2667942.1617214523822@mail.yahoo.com> From: Pierre Forstmann Message-ID: <01d84d64-99e1-d19c-1262-922f9fc15d0a@gmail.com> Date: Fri, 2 Apr 2021 09:06:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <1042003030.2667942.1617214523822@mail.yahoo.com> Content-Type: multipart/alternative; boundary="------------A6EA35CD8576502C9563428F" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------A6EA35CD8576502C9563428F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hello, This is a pg_upgrade known limitation that has been summarized by Greg Sabino Mullane on https://www.endpoint.com/blog/2016/12/07/postgres-statistics-and-pain-of-analyze this way: The nominal reason for not copying the data is that the table format may change from version to version. The real reason is that nobody has bothered to write the conversion logic yet, for pg_upgrade could certainly copy the pg_statistics information: the table has not changed for many years. Regards Pierre Forstmann Le 31/03/2021 à 20:15, Virendra Kumar a écrit : > Hello Team, > > I was doing an upgrade of one of our PG (9.6.11 to 11.9) database and > came across the question that what is reason PostgreSQL is not doing > copy of stats and we have to analyze right after upgrade. There are > two situations where this will help when we use this DB as our > enterprise database: > > 1. If DB is in magnitude of hundreds of TB and we have to do analyze > it might take several hours before we handover this to application > services. > > 2. We are loosing critical information like most common values and > most common freqs because these values are populated over time when > many-many sessions hit table and queries with different values of a > column. > > Any input on this is higly appreciated. > > > Regards, > Virendra Kumar > --------------A6EA35CD8576502C9563428F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Hello,

This is a pg_upgrade known limitation that has been summarized  by Greg Sabino Mullane on https://www.endpoint.com/blog/2016/12/07/postgres-statistics-and-pain-of-analyze

this way:

The nominal reason for not copying the data is that the table format may change from version to version. The real reason is that nobody has bothered to write the conversion logic yet, for pg_upgrade could certainly copy the pg_statistics information: the table has not changed for many years.

Regards

Pierre Forstmann

Le 31/03/2021 à 20:15, Virendra Kumar a écrit :
Hello Team,

I was doing an upgrade of one of our PG (9.6.11 to 11.9) database and came across the question that what is reason PostgreSQL is not doing copy of stats and we have to analyze right after upgrade. There are two situations where this will help when we use this DB as our enterprise database:

1. If DB is in magnitude of hundreds of TB and we have to do analyze it might take several hours before we handover this to application services.

2. We are loosing critical information like most common values and most common freqs because these values are populated over time when many-many sessions hit table and queries with different values of a column.

Any input on this is higly appreciated.


Regards,
Virendra Kumar

--------------A6EA35CD8576502C9563428F--