Hello, I wanted some guidance/suggestions about creating an spgist
extension. For context, i am a grad student doing research that involves
comparing the performance of different indexes for spatial data. We've
built a system that uses Postgres and one of the data structures we want to
use is a loose quadtree, but there is no implementation of this data
structure in spgist. The reason why I think this is pretty do-able is that
it is quite similar to a quadtree on boxes, which is implemented in
src/backend/utils/adt/geo_spgist.c.

Additionally, I found by grepping through the repo for the existing
functions in spgist/box_ops operator class that several catalog files need
to be updated to reflect a new operator class in spgist. The files that I
believe need to be changed to create a new
spgist_loose_box_ops operator class are:

src/include/catalog/pg_amop.dat
src/include/catalog/pg_amproc.dat
src/include/catalog/pg_opclass.dat
src/include/catalog/pg_opfamily.dat


I've poked around quite a bit in the spgist code and have tried making
minimal changes to geo_spgist.c, but I haven't done any development on
postgres before, so i'm running into some issues that I couldn't find help
with on the postgres slack, by searching the mailing list, or by scouring
the development wikis. For example, I wanted to just print out some data to
see what quadrant a box is being placed into in the geo_spgist.c code. I
understand that printing to stdout won't work in postgres, but I thought
that I could possibly write some data to the logfile. I tried updating a
function to use both elog and ereport and re-built the code. However, I
can't get anything to print out to the logfile no matter what I try. Does
anyone have tips for printing out and debugging in general for postgres
development?


Any tips or guidance would be much appreciated. Also, if there's a
different route I should go to turn this into a proposal for a patch please
let me know. I'm new to postgres dev.

Best,
Peter

Reply via email to