From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Stefan Litsche <slitsche(at)biosoft(dot)de> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Omitting relpages for toast table access not expected |
Date: | 2024-07-05 15:07:35 |
Message-ID: | 203951.1720192055@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Stefan Litsche <slitsche(at)biosoft(dot)de> writes:
> I want to share three observations which show not expected behavior.
> [ after forcing data to be toasted ]
> Shouldn't the cost of the plan also reflect the cost of accessing
> pages in the toast table?
This is expected: the planner does not currently try to account for
the cost of fetching toasted values. We have thought about that,
certainly. But it would be quite difficult to do so without
introducing a lot of error into the numbers, since in most non-toy
situations it's hard to predict what fraction of the values fetched
by a particular query will be toasted or how big they will be.
Another reason for not expending sweat here is that in most scenarios
those costs would be the same for any possible query plan, so that the
effort involved in making a better estimate wouldn't end up improving
the plan.
> So after dropping the table, recreating and analyzing it, I do not
> get updated values for relpages for the corresponding toast table.
> I would expect that the analyze command also updates the statistics
> for the toast table.
This doesn't surprise me enormously. We don't worry too much about
updating statistics for toast tables, because the planner wouldn't use
them anyway -- in particular I'm pretty sure ANALYZE doesn't examine
toast tables as such. relpages might get updated as a by-product of
VACUUM, but only if VACUUM judges that it's worth scanning the toast
table, which it won't unless some toasted values have been deleted
since last time.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Haifang Wang (Centific Technologies Inc) | 2024-07-05 22:00:11 | Windows Application Issues | PostgreSQL | REF # 51961374 |
Previous Message | Masahiko Sawada | 2024-07-05 14:52:52 | Re: Potential data loss due to race condition during logical replication slot creation |