NULL's support in SP-GiST - Mailing list pgsql-hackers

From Oleg Bartunov
Subject NULL's support in SP-GiST
Date
Msg-id Pine.LNX.4.64.1201312034280.12612@sn.sai.msu.ru
Whole thread Raw
Responses Re: NULL's support in SP-GiST  (Jaime Casanova <jaime@2ndquadrant.com>)
Re: NULL's support in SP-GiST  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi there,

attached patch introduces NULLs indexing for SP-GiST. With this patch
Sp-GiST supports IS NULL, IS NOT NULL clauses, as well as full index scan.

We added boolean satisfyAll field in spgInnerConsistentIn and spgLeafConsistentIn 
structures, which informs the  user-defined methods, that all search results 
satisfy a query and should be returned. Calls of consistent methods are
needed because they know how to reconstruct an original value.

Unlike BTree we can't introduce a rule like "NULL is greater than
anything else", because Sp-GiST  doesn't know  semantics of indexed data.
Also, Sp-GiST is essentially single-column index, so we can
store null values outside the main structure of index and use separate code 
path to work with NULLs. Actually, storing just ItemPointer 
(instead of the whole index tuple) is enough for NULLs, so we can reuse 
data tree storage from GIN, which used for storing 
ItemPointers for each indexed values. For that purpose, GinPageOpaqueData 
and SpGistPageOpaqueData should be compatible, at least at flag's
positions and values. In fact, it's needed only for vacuum code, 
which produces full index scan.



    Regards,        Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

pgsql-hackers by date:

Previous
From: Bernd Helmle
Date:
Subject: Re: pg_stats_recovery view
Next
From: Bernd Helmle
Date:
Subject: Re: Patch pg_is_in_backup()