Re: pg_stat_advisor extension

From: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org, a(dot)lepikhov(at)postgrespro(dot)ru
Subject: Re: pg_stat_advisor extension
Date: 2024-05-13 12:26:01
Message-ID: aa034271-821c-42f3-92a1-b4112111c9c2@tantorlabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>1. In the case of parallel workers the plan_rows value has a different semantics than the number of rows predicted. Just explore
get_parallel_divisor().

>2. The extension recommends new statistics immediately upon an error finding. But what if the reason for the error is stale statistics? Or
this error may be raised for only one specific set of constants, and
estimation will be done well in another 99.9999% of cases for the same
expression.

The new parameter, `pg_stat_advisor.analyze_scale_factor`, can suggest
the execution of the ANALYZE command on specific tables. The extension
now evaluates the ratio of `n_live_tup` (number of live tuples) to
`n_mod_since_analyze` (number of modifications since last analyze) in
the `pg_stat_all_tables` catalog. If this ratio exceeds the value
specified in `analyze_scale_factor`, the extension will suggest an
update to the table's statistics.

There are a lot of parameters that influences on estimated rows.
Statistics might not help improve estimated rows. This feature is
designed to provide users with data-driven insights to decide whether
updating statistics via the ANALYZE command could potentially improve
query performance. By suggesting rather than automatically executing
statistics updates, we empower you to make informed decisions based on
the specific needs and conditions of your database environment.

I've developed an extension that provides suggestions on whether to
update or create statistics for your PostgreSQL database, without
executing any changes. This approach allows you to consider various
parameters that influence row estimates and make informed decisions
about optimizing your database's performance.

Your feedback is invaluable, and we look forward to hearing about your
experiences and any improvements you might suggest. Best regards, Ilia
Evdokimov Tantor Labs LLC.

Attachment Content-Type Size
0001-pg_stat_advisor-extension.patch text/x-patch 22.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2024-05-13 12:27:49 RE: Slow catchup of 2PC (twophase) transactions on replica in LR
Previous Message Hayato Kuroda (Fujitsu) 2024-05-13 12:25:26 RE: Slow catchup of 2PC (twophase) transactions on replica in LR