Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs - Mailing list pgsql-bugs

From shihao zhong
Subject Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs
Date
Msg-id CAGRkXqSkyW7QqriK9v-aH0QjA7s_DhtEfG0RrxEy8jO3_d6LAw@mail.gmail.com
Whole thread
In response to BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs
List pgsql-bugs
Hi,

Here is a patch for the estimate. IS NOT DISTINCT FROM is estimated
like "=", so row pairs with NULL on both sides are never counted. The
patch adds the product of the two null fractions to the "=" estimate.

Two tables of 2000 rows, 30% NULL, joined on
x.a IS NOT DISTINCT FROM y.a:

  master   rows=1400    actual rows=361400
  patched  rows=361400  actual rows=361400

Thanks,
Shihao
Attachment

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #19730: PostgreSQL `pg_backup_start` accepts newlines in the backup label, producing an unrestorable `backup
Next
From: Rahul
Date:
Subject: Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs