From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | regrog <andrea(dot)vencato(at)gmail(dot)com>, pgsql-performance <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: view reading information_schema is slow in PostgreSQL 12 |
Date: | 2020-06-13 03:55:46 |
Message-ID: | CAApHDvrnop0h+du73FZKEzxd0CGP3RUoWPNha2ekz_F0YMNaYA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Sat, 13 Jun 2020 at 15:11, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I expect you're getting a fairly decent estimate for the "contype <>
> ALL" condition, but the planner has no idea what to make of the CASE
> construct, so it just falls back to a hard-wired default estimate.
This feels quite similar to [1].
I wondered if it would be more simple to add some smarts to look a bit
deeper into case statements for selectivity estimation purposes. An
OpExpr like:
CASE c.contype WHEN 'c' THEN 'CHECK' WHEN 'f' THEN 'FOREIGN KEY' WHEN
'p' THEN 'PRIMARY KEY' WHEN 'u' THEN 'UNIQUE' END = 'CHECK';
could be simplified to c.contype = 'c', which we should have
statistics for. There'd certainly be case statement forms that
couldn't be simplified, but I think this one could.
David
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-06-13 04:07:33 | Re: view reading information_schema is slow in PostgreSQL 12 |
Previous Message | David Rowley | 2020-06-13 03:15:15 | Re: view reading information_schema is slow in PostgreSQL 12 |