On Mon, Jan 16, 2023 at 09:59:38AM -0500, Tom Lane wrote:
> Harmen writes:
> > On Sat, Jan 14, 2023 at 11:23:07AM -0500, Tom Lane wrote:
> >> If you are running a reasonably recent PG version you should be able to
> >> fix that by setting up "extended statistics" on that pair of columns:
>
> >
Harmen writes:
> On Sat, Jan 14, 2023 at 11:23:07AM -0500, Tom Lane wrote:
>> If you are running a reasonably recent PG version you should be able to
>> fix that by setting up "extended statistics" on that pair of columns:
> CREATE STATISTICS dist4 (ndistinct) ON deleted, org_id FROM contactsbo
On Sat, Jan 14, 2023 at 11:23:07AM -0500, Tom Lane wrote:
> Harmen writes:
> > Works well enough. However, we now have an org_id which has > 10% of the
> > rows,
> > but only a handful rows where "deleted is null" matches (so the org has a
> > lot
> > of "deleted" contacts). The planner doesn't
Harmen writes:
> Works well enough. However, we now have an org_id which has > 10% of the rows,
> but only a handful rows where "deleted is null" matches (so the org has a lot
> of "deleted" contacts). The planner doesn't like this and it falls back to a
> full table scan for the above query.
> I