Re: [PATCH] Optimize IS DISTINCT FROM NULL => IS NOT NULL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marti Raudsepp <marti(at)juffo(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Optimize IS DISTINCT FROM NULL => IS NOT NULL
Date: 2012-03-08 17:35:36
Message-ID: 13411.1331228136@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Marti Raudsepp <marti(at)juffo(dot)org> writes:
> This patch enables a simple optimization in
> eval_const_expressions_mutator. If we know that one argument to
> DistinctExpr is NULL then we can optimize it to a NullTest, which can
> be an indexable expression.

Uh ... how much do we care about that? I can't say that I've heard many
people complain about the fact that IS [NOT] DISTINCT FROM is poorly
optimized -- which it is, in general, and this patch chips away at that
only a tiny bit, not enough to make it recommendable. If we really
wanted to make that a first-class operation we would need far more work
than this. Plus I don't see why anyone would write the specific case
"IS [NOT] DISTINCT FROM NULL" when they could write half as much.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marti Raudsepp 2012-03-08 18:16:00 Re: [PATCH] Optimize IS DISTINCT FROM NULL => IS NOT NULL
Previous Message Marti Raudsepp 2012-03-08 17:00:58 [PATCH] Optimize IS DISTINCT FROM NULL => IS NOT NULL