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

2017-11-13 Thread Alexander Korotkov
Hi! On Mon, Nov 13, 2017 at 6:47 AM, Connor Wolf wrote: > Ok, I've managed to get my custom index working. > Good! It's all on github here: https://github.com/fake-name/pg-spgist_hamming, if > anyone else needs a fuzzy-image searching system > that can

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

2017-11-12 Thread Connor Wolf
Ok, I've managed to get my custom index working. It's all on github here: https://github.com/fake-name/pg-spgist_hamming, if anyone else needs a fuzzy-image searching system that can integrate into postgresql.. It should be a pretty good basis for anyone else to use if they want to implement a

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

2017-11-05 Thread Connor Wolf
Never mind, it turns out the issue boiled down to me declaring the wrong prefixType in my config function. TL;DR - PEBKAC On Sun, Nov 5, 2017 at 1:09 AM, Connor Wolf wrote: > Ok, I've got everything compiling and it installs properly, but I'm > running into

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

2017-11-05 Thread Connor Wolf
Ok, I've got everything compiling and it installs properly, but I'm running into problems that I think are either a side-effect of implementing picksplit incorrectly (likely), or a bug in SP-GiST(?). Program received signal SIGSEGV, Segmentation fault. __memcpy_sse2_unaligned () at

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

2017-11-03 Thread Alexander Korotkov
On Fri, Nov 3, 2017 at 12:37 PM, Connor Wolf < conn...@imaginaryindustries.com> wrote: > EDIT: That's actually exactly how the example I'm working off of works. > DERP. The SQL is > > CREATE TYPE vptree_area AS > ( > center _int4, > distance float8 > ); > > CREATE OR REPLACE FUNCTION

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

2017-11-03 Thread Connor Wolf
Yeah, unfortunately, the way these type of metric trees work, the entire search procedure is a function of both the target value and the allowed search distance. The only way I can think of to return ordered results without just scanning the entire index would be to repeatedly search the index

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

2017-11-03 Thread Robert Haas
On Thu, Nov 2, 2017 at 9:53 AM, Connor Wolf wrote: > As such: > Will compound queries as I describe above basically require a custom type to > make it possible? My (admittedly naive) expectation > is that the eventual query for this index will look something like

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

2017-11-01 Thread Connor Wolf
Ok, more questions. I've been studying the implementation Alexander Korotkov sent, and I'm not seeing how to map some of the components onto the changes in the SP-GiST system that occured between Postgresql 9.2 and 9.3. The changes at that point seem to have been to change xxx_inner_consistent

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

2017-10-30 Thread Connor Wolf
I was mostly unclear on how I'd go about attaching the extension functions to the relevant indexing mechanism. From the looks of the vptree.tar.gz file (which is really, *really* helpful, incidentally!), a it's done via a custom operator class, which then gets passed to the actual index creation

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

2017-10-30 Thread Tom Lane
Alexander Korotkov writes: > I think Connor struggles to implement just an operator class. Advising him > to implement an index access method is a good way to get him away of > PostgreSQL hacking for a long time :) Yeah. To answer the question a bit more directly:

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

2017-10-30 Thread Alexander Korotkov
On Mon, Oct 30, 2017 at 2:07 PM, Oleg Bartunov wrote: > On Mon, Oct 30, 2017 at 12:05 PM, Oleg Bartunov > wrote: > > On Sun, Oct 29, 2017 at 10:07 AM, Connor Wolf > > wrote: > >> Hi there! > >> > >> I'm looking at

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

2017-10-30 Thread Alexander Korotkov
Hi! On Sun, Oct 29, 2017 at 12:07 PM, Connor Wolf wrote: > 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 >

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

2017-10-30 Thread Oleg Bartunov
On Mon, Oct 30, 2017 at 12:05 PM, Oleg Bartunov wrote: > On Sun, Oct 29, 2017 at 10:07 AM, Connor Wolf > wrote: >> Hi there! >> >> I'm looking at implementing a custom indexing scheme, and I've been having >> trouble understanding the proper

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

2017-10-30 Thread Oleg Bartunov
On Sun, Oct 29, 2017 at 10:07 AM, Connor Wolf wrote: > 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

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

2017-10-30 Thread Connor Wolf
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