From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Lewis <mlewis(at)entrata(dot)com> |
Cc: | PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Misestimate when applying condition like id = id |
Date: | 2020-08-20 20:16:35 |
Message-ID: | 1739751.1597954595@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Michael Lewis <mlewis(at)entrata(dot)com> writes:
> Simplified example query-
> explain
> select * from organizations o where id = id;
> On a PG10 instance I get-
> Seq Scan on organizations o (cost=0.00..4.21 ***rows=1*** width=37)
> Filter: (id = id)
> On a PG11 instance with the same or very very similar data, I get-
> Seq Scan on organizations o (cost=0.00..5.70 ***rows=270*** width=37)
> Filter: (id IS NOT NULL)
> Given this is a not null field, it translates to "is true" basically. The
> real query that this example was extracted from apparently had a typo in
> the join resulting in this bogus id = id condition, but I still curious
> about where this estimate change comes from.
It's an intentional v11 change, cf
https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=8ec5429e2
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Jason Myers | 2020-08-20 20:37:23 | Re: Orphaned relations after crash/sigkill during CREATE TABLE |
Previous Message | Michael Lewis | 2020-08-20 19:42:03 | Misestimate when applying condition like id = id |