NULL's support in SP-GiST

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: NULL's support in SP-GiST
Date: 2012-02-02 21:26:13
Message-ID: Pine.LNX.4.64.1201312034280.12612@sn.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

Attachment Content-Type Size
spgist_null-0.8.gz application/octet-stream 12.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-02-02 21:44:10 Re: BUG #6425: Bus error in slot_deform_tuple
Previous Message Bernd Helmle 2012-02-02 21:08:35 Re: pg_stats_recovery view