Re: Index not used with IS NULL

From: Dmitry Tkach <dmitry(at)openratings(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Index not used with IS NULL
Date: 2003-02-17 17:18:16
Message-ID: 3E511958.8070706@openratings.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:

>Dima Tkach <dmitry(at)openratings(dot)com> writes:
>
>
>>I'd be happy to come up with a patch... It just was my understanding
>>that you would not accept such a patc hanyway, because your opinion is
>>that it is unnecessary and dangerous... Did I misunderstand you here?
>>
>>
>
>I don't see anything dangerous about it --- except perhaps to
>readability and mantainability of the code. The problem is that IS NULL
>doesn't fit into the operator-and-opclass model of what indexes can do.
>If you can find a solution to that problem that's not a complete kluge,
>I'm all ears.
>
> regards, tom lane
>
>
Well... At first glance, it seems that what needs to be done is:

- add a special case in is_indexable_operator() to return true for IS_NULL
- modify _bt_checkkeys () to return isNull from inside if
(key->sk_flags & SK_ISNULL) clause instead of just false.
- remove sk_flags & SK_ISNULL checks from _bt_orderkeys

Obviously, I haven't tested this, and I may very well have missed
something (I will, of course, inspect it and test thoroughly if you ok
the change in principle - just don't want to spend much time right now
on something, that may end up not being needed to anybody), but this
looks to me like pretty much it.

Dima

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2003-02-17 18:20:08 Re: PostGreSQL Replication question !!
Previous Message Dennis Gearon 2003-02-17 17:17:48 BIT STRINGS