Re: Backwards index scan

From: John Sidney-Woollett <johnsw(at)wardbrook(dot)com>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Carlos Oliva <carlos(at)pbsinet(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Backwards index scan
Date: 2006-06-07 06:59:54
Message-ID: 4486796A.5030009@wardbrook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for putting me straight - I thought I remembered a previous post
from Tom about nulls not being indexed but it was probably referring to
partial indexes not indexing values that are null...

Coalescing null values might still be helpful to ensure that they are
ordered in the index at a specific location (either the beginning or the
end depending on your substitution value).

John

Greg Stark wrote:
> John Sidney-Woollett <johnsw(at)wardbrook(dot)com> writes:
>
>
>>I don't think that null values are indexed - you'll probably need to coalesce
>>your null data value to some value if you want it indexed.
>
>
> That is most definitely not true for Postgres. NULL values are included in the
> index.
>
> However NULLs sort as greater than all values in Postgres. So when you sort
> descending they'll appear *first*. If you sort ascending they'll appear last.
>
> If you have any clauses like 'WHERE col > foo' then it will not be true for
> NULL values of col regardless of what foo is and those records will be
> dropped. This is true regardless of whether there's an index.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tim J. Hart 2006-06-07 07:12:39 What are the characteristics of a good user-defined data type
Previous Message Eric Montague 2006-06-07 04:48:36 Re: psql: krb5_sendauth: Bad application version was sent