Re: a wrong index choose when statistics is out of date - Mailing list pgsql-hackers

From David Rowley
Subject Re: a wrong index choose when statistics is out of date
Date
Msg-id CAApHDvo5S5xqWQR1HKzx=5UpBr1ZKhwEtxEkt=3q0z4oR+TnPA@mail.gmail.com
Whole thread Raw
In response to Re: a wrong index choose when statistics is out of date  (Andy Fan <zhihuifan1213@163.com>)
Responses Re: a wrong index choose when statistics is out of date
List pgsql-hackers
On Wed, 6 Mar 2024 at 02:09, Andy Fan <zhihuifan1213@163.com> wrote:
>     This patch introduces a new attoptions like this:
>
>     ALTER TABLE t ALTER COLUMN col set (force_generic=true);
>
>     Then selfunc.c realizes this and ignore the special Const value, then
>     average selectivity is chosen. This fall into the weakness of generic
>     plan, but this patch doesn't introduce any new weakness and we leave the
>     decision to user which could resolve some problem. Also this logic only
>     apply to eqsel since the ineqsel have the get_actual_variable_range
>     mechanism which is helpful for index choose case at least.

If you don't want the planner to use the statistics for the column why
not just do the following?

ALTER TABLE t ALTER COLUMN col SET STATISTICS 0;

ANALYZE won't delete any existing statistics, so that might need to be
done manually.

David



pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: Function and Procedure with same signature?
Next
From: Jelte Fennema-Nio
Date:
Subject: Re: [EXTERNAL] Re: Add non-blocking version of PQcancel