[HACKERS] How to implement a SP-GiST index as a extension module?

Поиск
Список
Период
Сортировка
От Connor Wolf
Тема [HACKERS] How to implement a SP-GiST index as a extension module?
Дата
Msg-id d0d56b6f-3190-f2a4-61e8-4e75ed1370e7@imaginaryindustries.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Index only scan for cube and seg  (Andrey Borodin <x4mmm@yandex-team.ru>)
Ответы Re: [HACKERS] How to implement a SP-GiST index as a extension module?  (Oleg Bartunov <obartunov@gmail.com>)
Re: [HACKERS] How to implement a SP-GiST index as a extension module?  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
Список pgsql-hackers
Hi there!

I'm looking at implementing a custom indexing scheme, and I've been having trouble understanding the proper approach.

Basically, I need a BK tree, which is a tree-structure useful for indexing arbitrary discrete metric-spaces (in my case, I'm interested in indexing across the hamming edit-distance of perceptual hashes, for fuzzy image searching). I'm pretty sure a SP-GiST index is the correct index type, as my tree is intrinsically unbalanced.

I have a functional stand-alone implementation of a BK-Tree, and it works very well, but the complexity of managing what is basically a external index for my database has reached the point where it's significantly problematic, and it seems to be it should be moved into the database.

Anyways, looking at the contents of postgres/src/backend/access/spgist, it looks pretty straightforward in terms of the actual C implementation, but I'm stuck understanding how to "install" a custom SP-GiST implementation. There are several GiST indexing implementations in the contrib directory, but no examples for how I'd go about implementing a loadable SP-GiST index.

Basically, my questions are:
  • Is it possible to implement a SP-GiST indexing scheme as a loadable module?
    • If so, how?
    • And is there an example I can base my implementation off of?

I'm relatively comfortable with C (much moreso with C++), but I haven't spent a lot of time looking at the postgresql codebase.  I don't think I could start from a empty folder and make a properly-implemented module in any reasonable period of time, so if I have a working example for some sort of index that uses the same interfaces that would really help a lot.

Thanks!
Connor

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Chris Travers
Дата:
Сообщение: Re: [HACKERS] proposal: schema variables
Следующее
От: Hannu Krosing
Дата:
Сообщение: Re: [HACKERS] proposal: schema variables