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 1pNDBp-0003X2-2t for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Feb 2023 13:30:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pNDBm-0005rh-Sn for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Feb 2023 13:30:14 +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 1pNDBm-0005rY-J3 for pgsql-hackers@lists.postgresql.org; Wed, 01 Feb 2023 13:30:14 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pNDBf-0002yB-JH for pgsql-hackers@lists.postgresql.org; Wed, 01 Feb 2023 13:30:13 +0000 Received: by mail-ed1-x52f.google.com with SMTP id eq11so684117edb.6 for ; Wed, 01 Feb 2023 05:30:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=lMwrdLR734XRttoSMQPpnkWWIwCWkqG7W1Y8GZV3iDc=; b=J3pTKr4lD7LDAv7mDSVV/hTm5Q0Imut2C+oK3KHXKCswtsmPGgrM7lSfyy+5xzXWxv sXG0Igh1WwYJnHJLSanJPqH4bRvLnUFxEr+Rwx2P4YrjOgUAYkaIramTa1bFOJU7abup ujrYLgbM+v9DZ0qrXypNYRkymAqE7qXsaXmgKlyhAJvJdtJRYaSbILyhjtEHYv8jxPWq sSEI0N7GPUzWZsEyXmj4ix084NvodMV8BmnCCcP5BzDkGytdsZhAwaRfkvlLfUeb2Fwn XvcpDlj793qUcpFVZIASd5mRI3/kxx+7atQggUbK2RnPL0wJ1wtaBT8eUqZI1EbDqrpJ /VJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lMwrdLR734XRttoSMQPpnkWWIwCWkqG7W1Y8GZV3iDc=; b=3DFf+H9xOgfNDd256LirW6GuL23C3DBjOtSHudsAuUVUKeUoA2M64eRt5e3VspFvgy /5ei6sQwdmllO2xY9yqkTGMZNNA8GFHGRjRSXHDABEFOVcRLwwdw4xMjOxy9icqk+6X0 0xFrAeCdjWEYT9+6T+TSBS/GljalL9LxqwJApNrUQHYzDYSTbiGCD4OAlWTpgE4FxgXQ 7SpQtBPseiwrXtkefvoPCcMSZ+0jc2WasybabLyCjXRFY4ADMK+lA7x1BysuTaqkg0z8 TfYb1TAL5r9a1L14b3ysKEWBJoXDqpXBD3lYStMWkQMeW+DKH0wTfTHKN7oJtEvxFZdH Uk5w== X-Gm-Message-State: AO0yUKVFzF7zKNm9CkC1jJwCjhkCfY36vxNFa3cSGqOE3CnhjtBQ5tim s02PiQj148akGH+UnnCyC6HIZ0yYdVjuchaPpbgTD1RTe/Xpt3GxjcseulR+e7235YFoD2Gm2qX /uJLXMuxmxKew1AC76kZ1flRXg/jGVqI5j6j8uzfsVvnjO/zM1+3+Et8kkYMHmWfDAjDM1xSWCq MuMRGVTLwoSWLNuKkTjafkffN5mLkNDKZD5lfIC7QcT3qKwQxVZPKnyPKx7doIyeEf7iSOuchvS 8cQ7XducEGzVd+hc88pubRpta8dCcYvJRee1+68x1kQ2iBBiAFcX1kkomFD X-Google-Smtp-Source: AK7set9DdhscpA4hXnPdTZ+1BrrqLmNqMR3OHv5wAmsyJgUJ53vS9H6teh14YJUCBdutxY8I+X92oA== X-Received: by 2002:a50:8d86:0:b0:4a2:7cbc:7f49 with SMTP id r6-20020a508d86000000b004a27cbc7f49mr1677735edh.34.1675258206049; Wed, 01 Feb 2023 05:30:06 -0800 (PST) Received: from [10.137.0.17] (natg.fit.cvut.cz. [147.32.232.140]) by smtp.gmail.com with ESMTPSA id b18-20020a0564021f1200b004a27046b7a7sm2043721edb.73.2023.02.01.05.30.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Feb 2023 05:30:05 -0800 (PST) Message-ID: Date: Wed, 1 Feb 2023 14:30:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: Support for dumping extended statistics Content-Language: en-US To: Bruce Momjian , Hari krishna Maddileti Cc: PostgreSQL Hackers References: From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/7/23 03:39, Bruce Momjian wrote: > On Thu, Jan 5, 2023 at 06:29:03PM +0000, Hari krishna Maddileti wrote: >> Hi Team, >> In order to restore dumped extended statistics (stxdndistinct, >> stxddependencies, stxdmcv) we need to provide input functions to parse >> pg_distinct/pg_dependency/pg_mcv_list strings. >> >> Today we get the ERROR "cannot accept a value of type pg_ndistinct/ >> pg_dependencies/pg_mcv_list" when we try to do an insert of any type. >> >> Approch tried: >> >> - Using yacc grammar file (statistics_gram.y) to parse the input string to its >> internal format for the types pg_distinct and pg_dependencies >> >> - We are just calling byteain() for serialized input text of type pg_mcv_list. >> >> Currently the changes are working locally, I would like to push the commit >> changes to upstream if there any usecase for postgres. Would like to know if >> there any interest from postgres side. > > There is certainly interest in allowing the optimizer statistics to be > dumped and reloaded. This could be used by pg_restore and pg_upgrade. > Indeed, although I think it'd be better to deal with regular statistics (which is what 99% of systems use). Furthermore, we should probably think about differences between major versions - until now we could change on-disk format of the statistics, because we have reset them. It'd be silly to do dump on version X, and then fail to restore it on (X+1) just because the statistics changed a bit. So we need to be able to determine is the statistics has the correct format/version, or what. And we need to do that for pg_upgrade. At the very least we need an option to skip restoring statistics, or something like that. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company