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 1sgMzh-001Fj5-Ni for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Aug 2024 11:25: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 1sgMzf-00FBu9-An for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Aug 2024 11:25:43 +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 1sgMze-00FBtg-Vw for pgsql-hackers@lists.postgresql.org; Tue, 20 Aug 2024 11:25:43 +0000 Received: from forward501d.mail.yandex.net ([178.154.239.209]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgMzX-000bRX-RH for pgsql-hackers@postgresql.org; Tue, 20 Aug 2024 11:25:42 +0000 Received: from mail-nwsmtp-smtp-production-main-39.klg.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-39.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:96c7:0:640:6549:0]) by forward501d.mail.yandex.net (Yandex) with ESMTPS id 10DAD61204; Tue, 20 Aug 2024 14:25:35 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-39.klg.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id WPL1Iw6kFa60-uU94NGQ0; Tue, 20 Aug 2024 14:25:34 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tantorlabs.com; s=mail; t=1724153134; bh=7ENEwKa+zGMCFOIPXDcn/c3eYJMQ9ghBUj0as90fzHc=; h=In-Reply-To:Cc:Date:References:To:Subject:Message-ID:From; b=KEMVFyACfaq7Xo2rr5/UdIxX7xjezRCrMeuyzHTZqxj+Y9KIBNRv1OVVJVXKoldID 9UF3y35tbewwK1w/ptKAWKD3NMSB/u4fIUNaMT8/z1bF/7bcbtzVTKr4oxWKwln06Q n0x+0DyB+o5zK0+idu6Hb4WxqIrI9FCVvuwK/A4E= Authentication-Results: mail-nwsmtp-smtp-production-main-39.klg.yp-c.yandex.net; dkim=pass header.i=@tantorlabs.com Content-Type: multipart/alternative; boundary="------------KaROnRDrW2d0kTtZUDxWiEQF" Message-ID: Date: Tue, 20 Aug 2024 14:25:32 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: ANALYZE ONLY To: Jelte Fennema-Nio , Michael Harris Cc: PostgreSQL-development References: Content-Language: en-US From: Ilia Evdokimov In-Reply-To: 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. --------------KaROnRDrW2d0kTtZUDxWiEQF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 20.8.24 10:42, Jelte Fennema-Nio wrote: > On Tue, 20 Aug 2024 at 07:52, Michael Harris wrote: >> 1. Would such a feature be welcomed? Are there any traps I might not >> have thought of? > I think this sounds like a reasonable feature. > > >> 2. The existing ANALYZE command has the following structure: >> >> ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ] >> >> It would be easiest to add ONLY as another option, but that >> doesn't look quite >> right to me - surely the ONLY should be attached to the table name? >> An alternative would be: >> >> ANALYZE [ ( option [, ...] ) ] [ONLY] [ table_and_columns [, ...] ] >> >> Any feedback or advice would be great. > Personally I'd prefer a new option to be added. But I agree ONLY isn't > a good name then. Maybe something like SKIP_PARTITIONS. > Hi everyone, Your proposal is indeed interesting, but I have a question: can't your issue be resolved by properly configuring |autovacuum| instead of developing a new feature for |ANALYZE|? From my perspective, |ANALYZE| is intended to forcibly gather statistics from all partitioned tables. If the goal is to ensure that statistics are updated at the right moment, adjusting the |autovacuum_analyze_threshold| and |autovacuum_analyze_scale_factor| parameters might be the solution. -- Regards, Ilia Evdokimov, Tantor Labs LCC. --------------KaROnRDrW2d0kTtZUDxWiEQF Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

On 20.8.24 10:42, Jelte Fennema-Nio wrote:

On Tue, 20 Aug 2024 at 07:52, Michael Harris <harmic@gmail.com> wrote:
  1. Would such a feature be welcomed? Are there any traps I might not
have thought of?
I think this sounds like a reasonable feature.


  2. The existing ANALYZE command has the following structure:

     ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]

     It would be easiest to add ONLY as another option, but that
doesn't look quite
     right to me - surely the ONLY should be attached to the table name?
     An alternative would be:

     ANALYZE [ ( option [, ...] ) ] [ONLY] [ table_and_columns [, ...] ]

Any feedback or advice would be great.
Personally I'd prefer a new option to be added. But I agree ONLY isn't
a good name then. Maybe something like SKIP_PARTITIONS.


Hi everyone,

Your proposal is indeed interesting, but I have a question: can't your issue be resolved by properly configuring autovacuum instead of developing a new feature for ANALYZE?

From my perspective, ANALYZE is intended to forcibly gather statistics from all partitioned tables. If the goal is to ensure that statistics are updated at the right moment, adjusting the autovacuum_analyze_threshold and autovacuum_analyze_scale_factor parameters might be the solution.

-- 
Regards,
Ilia Evdokimov,
Tantor Labs LCC.
--------------KaROnRDrW2d0kTtZUDxWiEQF--