Convert coalesce to or/and
| От | Nicolas Adenis-Lamarre |
|---|---|
| Тема | Convert coalesce to or/and |
| Дата | |
| Msg-id | CACPGbcsUBGvtLFp+G6e0xb6G5d_4UZJz-BwnJe8EsPcd713NJA@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: Convert coalesce to or/and
|
| Список | pgsql-hackers |
I noticed that in the code coalesce is optimized by removing values after non null variables. Before seeing that, i would think that functions would not have been optimized because in a sens, it hardcodes its behavior (i guess coalesce could be overwritten). So my question is : would it be accepted to do a patch to replace coalesce by and/or, mainly to fix related estimations. This is an a mistake i fix from times to times on developments. It could be restricted to coalesce containing only simple columns variables. example: explain analyze select * from people p where coalesce(firstname, lastname) = 'Louis' -- Seq Scan on people p (rows=732) (actual rows=3856.00 loops=1) -- always computed to 732 for any value explain analyze select * from people p where firstname = 'Louis' or (firstname is null and lastname = 'Louis') -- Seq Scan on people p (rows=3862) (actual rows=3856.00 loops=1)
В списке pgsql-hackers по дате отправления: