Re: ANALYZE ONLY

From: Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>
To: Michael Harris <harmic(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, postgres(at)jeltef(dot)nl, ilya(dot)evdokimov(at)tantorlabs(dot)com
Subject: Re: ANALYZE ONLY
Date: 2024-08-22 11:26:11
Message-ID: CAGPVpCT2_fCP-GgObXNOkMXEvKU2L6Gud2ABpGfRQ8--9ed=WA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Michael,

Thanks for the patch.
I quickly tried running some ANALYZE ONLY queries, it seems like it works
fine.

-ANALYZE [ ( <replaceable class="parameter">option</replaceable> [, ...] )
> ] [ <replaceable class="parameter">table_and_columns</replaceable> [, ...] ]
> +ANALYZE [ ( <replaceable class="parameter">option</replaceable> [, ...] )
> ] [ [ ONLY ] <replaceable class="parameter">table_and_columns</replaceable>
> [, ...] ]

It seems like extended_relation_expr allows "tablename *" syntax too. That
should be added in docs as well. (Same for VACUUM doc)

<para>
> For partitioned tables, <command>ANALYZE</command> gathers statistics
> by
> sampling rows from all partitions; in addition, it will recurse into
> each
> partition and update its statistics. Each leaf partition is analyzed
> only
> once, even with multi-level partitioning. No statistics are collected
> for
> only the parent table (without data from its partitions), because with
> partitioning it's guaranteed to be empty.
> </para>

We may also want to update the above note in ANALYZE doc.

+-- ANALYZE ONLY / VACUUM ONLY on partitioned table
> +CREATE TABLE only_parted (a int, b char) PARTITION BY LIST (a);
> +CREATE TABLE only_parted1 PARTITION OF vacparted FOR VALUES IN (1);

+INSERT INTO only_parted1 VALUES (1, 'a');
>

Tests don't seem right to me.
I believe the above should be " PARTITION OF only_parted " instead of
vacparted.
It may better to insert into partitioned table (only_parted) instead of the
partition (only_parted1);

Also it may be a good idea to test VACUUM ONLY for inheritance tables the
same way you test ANALYZE ONLY.

Lastly, the patch includes an unrelated file (compile_flags.txt) and has
whitespace errors when I apply it.

Regards,
--
Melih Mutlu
Microsoft

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rafia Sabih 2024-08-22 11:29:07 Re: Support tid range scan in parallel?
Previous Message David Rowley 2024-08-22 11:15:00 Re: Redundant Result node