Re: Convert coalesce to or/and - Mailing list pgsql-hackers

From Nicolas Adenis-Lamarre
Subject Re: Convert coalesce to or/and
Date
Msg-id CACPGbctvagRdjq0EUvj2kmoZ52c50zz1-gKhb_gexN1tBCuaXQ@mail.gmail.com
Whole thread Raw
In response to Re: Convert coalesce to or/and  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Convert coalesce to or/and
List pgsql-hackers
I attached a patch proposition.

explain analyze
select *
from people p
where coalesce(firstname, lastname) = 'Louis'
-- before: Seq Scan on people p (cost=0.00..4015.04 rows=732
width=321) (actual time=0.019..11.217 rows=3856.00 loops=1)
-- after: Seq Scan on people p (cost=0.00..4015.04 rows=3872
width=177) (actual time=0.026..13.730 rows=3856.00 loops=1)

explain analyze
select *
from people p
where firstname = 'Louis' or (firstname is null and lastname = 'Louis')
-- Seq Scan on people p (cost=0.00..4381.24 rows=3872 width=177)
(actual time=0.016..14.899 rows=3856.00 loops=1)



Nicolas

Attachment

pgsql-hackers by date:

Previous
From: Andreas Karlsson
Date:
Subject: Re: pg_dump: Add ExecuteSqlCopy and simplify ExecuteSqlQuery
Next
From: Xuneng Zhou
Date:
Subject: Re: Implement waiting for wal lsn replay: reloaded