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 1t510I-003a1U-J2 for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Oct 2024 11:00:14 +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 1t510G-00FqYi-Ns for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Oct 2024 11:00:13 +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 1t510G-00FqXJ-Cu for pgsql-hackers@lists.postgresql.org; Sun, 27 Oct 2024 11:00:12 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t5109-0036Mk-8g for pgsql-hackers@lists.postgresql.org; Sun, 27 Oct 2024 11:00:10 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-53a007743e7so3960286e87.1 for ; Sun, 27 Oct 2024 04:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730026803; x=1730631603; darn=lists.postgresql.org; 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=y3eblaAmfr+ZdRBG4DaJjqU6X7PsyPKy5bkFWUhxQbg=; b=N+XNNSalDadnshr1/EOA/jJbf2wZme9SfO5E5ynJrlv1hJmGWYB9RBn4H9VVT8P6If SKBmWdEAJp2N0o47LWtL0UIu+cW2oF5ty4MnJqNl4pWnclSnZqRQNdhEjsNeY0zsaOqc aetPJW3tTly7vfbiZNqX7gSawpWL/JhUyeo+pStG4eWbRoe2VpaocHo+ImpJsvV2lff3 jQd426W7dGNpScscQlPEfVWoplAuFGInfWVOiCIddtnr8QuKnoFJ0XOcsSzhgRHrG9Co Y1p4Seortojq8+zrUr74rkRkbAaTZQPaAlCDvPga/96LlpBWkE+OuJVK21CuEA8hdd+J WKtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730026803; x=1730631603; 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=y3eblaAmfr+ZdRBG4DaJjqU6X7PsyPKy5bkFWUhxQbg=; b=CEf9+HVu7xLCHPB83BAtzV3ReLKjDSzpqwmawLETqyZ49lZvrEmOURgHfjqP2XXYvy JqZlEkn5qheG+O+O4rBgUedkI9epbiUC22jVb9DVsfT0/BGOktBn7iCZsQxPKl8Qz8Cd LZ9fTCGmyI4G1fhY9Mnl1eHjK/G4LCC5dIjJ2qrq3dCaOtrJSX1qOttVsIgBgAKBMKpu WANYrSpHNGGa16eSRxP+MBzqiXbFWkkicp1VOjYhk9xCiOzZMVCf6ErK7zf6O4AemS13 Z9+hjWkIYnWIaVmZ59YZWOrbjtSnZJRLHQw9TGlpMSzUvjP3MKRwxrmiCjrmUfyxozue mv9A== X-Forwarded-Encrypted: i=1; AJvYcCWIXQbJvzg1QPJgbTVyb2kUSYlwkmiJ9eVcsoLtmhuPAT2uovuvZfE+T0VD0YW02aJg2MxmYNLOzCUQ07g6@lists.postgresql.org X-Gm-Message-State: AOJu0YwcC+MT/1W+2MD/zfRnY3353xG1pLEhPIVCla2LDyakjYMivZ1L /h4yQO8olWA66j86z5yoDkWNMj1rLIMTbqC7fGYqz0peFePJx9fc X-Google-Smtp-Source: AGHT+IGHQQbaIXjVMQTQo9T06w/N/q0AG+LZRSjN4YVGq64xGORX9H9nktVUl0Sprbu018qDMl66/Q== X-Received: by 2002:a05:6512:2306:b0:539:f7de:df84 with SMTP id 2adb3069b0e04-53b348c7059mr2123986e87.10.1730026802269; Sun, 27 Oct 2024 04:00:02 -0700 (PDT) Received: from [1.0.0.7] ([178.155.31.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53b2e12452fsm759022e87.73.2024.10.27.04.00.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Oct 2024 04:00:01 -0700 (PDT) Message-ID: <98b2fcf0-f701-369e-d63d-6be9739ce17c@gmail.com> Date: Sun, 27 Oct 2024 14:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Statistics Import and Export Content-Language: en-US To: Jeff Davis , Corey Huinker , jian he Cc: Matthias van de Meent , Bruce Momjian , Tom Lane , Nathan Bossart , Magnus Hagander , Stephen Frost , Ashutosh Bapat , Peter Smith , PostgreSQL Hackers , alvherre@alvh.no-ip.org References: <9e068620350f0158e791fc0b9a68df896d4402c6.camel@j-davis.com> <11bb2c7403d4a7421fe8b09df6737aa83976266e.camel@j-davis.com> From: Alexander Lakhin In-Reply-To: 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 Hello Jeff and Corey, 26.10.2024 01:18, Jeff Davis wrote: > On Tue, 2024-09-17 at 05:02 -0400, Corey Huinker wrote: >> I've taken most of Jeff's work, reincorporated it into roughly the >> same patch structure as before, and am posting it now. > I have committed the import side of this patch series; that is, the > function calls that can load stats into an existing cluster without the > need to ANALYZE. > > The pg_restore_*_stats() functions are designed such that pg_dump can > emit the calls. Some design choices of the functions worth noting: Please look at the following seemingly atypical behavior of the new functions: CREATE TABLE test(id int); SELECT pg_restore_attribute_stats(   'relation', 'test'::regclass,   'attname', 'id'::name,   'inherited', false); SELECT pg_restore_attribute_stats(   'relation', 'test'::regclass,   'attname', 'id'::name,   'inherited', false ) FROM generate_series(1, 2); ERROR:  XX000: tuple already updated by self LOCATION:  simple_heap_update, heapam.c:4353 Or: SELECT pg_clear_attribute_stats('test'::regclass, 'id'::name, false) FROM generate_series(1, 2); ERROR:  XX000: tuple already updated by self LOCATION:  simple_heap_delete, heapam.c:3108 Best regards, Alexander