Re: pg15 inherited stats expressions: cache lookup failed for statistics object

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg15 inherited stats expressions: cache lookup failed for statistics object
Date: 2022-11-01 09:33:24
Message-ID: CAMbWs48pb_-fV=kG8CRVvZEHhCgTFUi6XY6UPK9Ob32LzH+d8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 31, 2022 at 1:33 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Mon, Oct 31, 2022 at 01:12:09PM +0800, Richard Guo wrote:
> > BTW, I noticed a micro-optimization opportunity in examine_variable that
> > we can fetch the RangeTblEntry for 'onerel' outside the foreach loop
> > when iterating the extended stats so that we can do it only once rather
> > than for each stat.
>
> Isn't that the kind of thing where we'd better have some regression
> coverage?

Yeah, we need to have some regression tests for that. I come up with a
case in stats_ext like below

CREATE STATISTICS stxdinp ON (a + 1), a, b FROM stxdinp;
SELECT * FROM check_estimated_rows('SELECT a + 1, b FROM ONLY stxdinp GROUP
BY 1, 2');

This case should be able to cover both expression stats and ndistinct
stats. Hence, attach v2 patch.

Thanks
Richard

Attachment Content-Type Size
v2-0001-Skip-statistics-with-mismatching-stxdinherit-flag.patch application/octet-stream 4.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2022-11-01 09:51:42 Re: [Refactor]Avoid to handle FORCE_NOT_NULL/FORCE_NULL options when COPY TO
Previous Message Simon Riggs 2022-11-01 09:10:20 Re: psql: Add command to use extended query protocol