[PATCH v2] Introduce spgist quadtree @<(point,circle) operator

Started by Matwey V. Kornilovover 7 years ago4 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliesbuild failedCI history

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t40622_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t40622_1 && git checkout t40622_1

Patchset v1 (message #1) is on t40622_1

Jump to latest
#1Matwey V. Kornilov
matwey.kornilov@gmail.com

Hi,

This patch series is to add support for spgist quadtree @<(point,circle)
operator. The first two patches are to refactor existing code before
implemention the new feature. The third commit is the actual implementation
provided with a set of simple unit tests.

Changes since v2:
- fix coding style
- add comment to spg_quad_inner_consistent_circle_helper()
- rework spg_quad_inner_consistent_circle_helper() using HYPOT() to make the
search consistent with filter scan

Matwey V. Kornilov (3):
Introduce helper variable in spgquadtreeproc.c
Introduce spg_quad_inner_consistent_box_helper() in spgquadtreeproc.c
Add initial support for spgist quadtree @<(point,circle) operator

src/backend/access/spgist/spgquadtreeproc.c | 147 +++++++++++++++-------
src/include/catalog/pg_amop.dat | 3 +
src/test/regress/expected/create_index_spgist.out | 96 ++++++++++++++
src/test/regress/sql/create_index_spgist.sql | 32 +++++
4 files changed, 234 insertions(+), 44 deletions(-)

--
2.13.7

--
With best regards,
Matwey V. Kornilov

Attachments:

t40622_1
v2-0002-Introduce-spg_quad_inner_consistent_box_helper-in.patchtext/x-patch; charset=US-ASCII; name=v2-0002-Introduce-spg_quad_inner_consistent_box_helper-in.patchDownload+32-33
v2-0003-Add-initial-support-for-spgist-quadtree-point-cir.patchtext/x-patch; charset=US-ASCII; name=v2-0003-Add-initial-support-for-spgist-quadtree-point-cir.patchDownload+197-8
v2-0001-Introduce-helper-variable-in-spgquadtreeproc.c.patchtext/x-patch; charset=US-ASCII; name=v2-0001-Introduce-helper-variable-in-spgquadtreeproc.c.patchDownload+9-10
#2Michael Paquier
michael@paquier.xyz
In reply to: Matwey V. Kornilov (#1)
Re: [PATCH v2] Introduce spgist quadtree @<(point,circle) operator

On Mon, May 20, 2019 at 02:32:39PM +0300, Matwey V. Kornilov wrote:

This patch series is to add support for spgist quadtree @<(point,circle)
operator. The first two patches are to refactor existing code before
implemention the new feature. The third commit is the actual implementation
provided with a set of simple unit tests.

Could you add that to the next commit fest please? Here you go:
https://commitfest.postgresql.org/23/
--
Michael

#3Matwey V. Kornilov
matwey.kornilov@gmail.com
In reply to: Michael Paquier (#2)
Re: [PATCH v2] Introduce spgist quadtree @<(point,circle) operator

вт, 21 мая 2019 г. в 08:43, Michael Paquier <michael@paquier.xyz>:

On Mon, May 20, 2019 at 02:32:39PM +0300, Matwey V. Kornilov wrote:

This patch series is to add support for spgist quadtree @<(point,circle)
operator. The first two patches are to refactor existing code before
implemention the new feature. The third commit is the actual implementation
provided with a set of simple unit tests.

Could you add that to the next commit fest please? Here you go:
https://commitfest.postgresql.org/23/

Done

--
Michael

--
With best regards,
Matwey V. Kornilov

#4Alexander Korotkov
aekorotkov@gmail.com
In reply to: Matwey V. Kornilov (#3)
Re: [PATCH v2] Introduce spgist quadtree @<(point,circle) operator

Hi Matwey,

On Tue, May 21, 2019 at 10:23 AM Matwey V. Kornilov
<matwey.kornilov@gmail.com> wrote:

вт, 21 мая 2019 г. в 08:43, Michael Paquier <michael@paquier.xyz>:

On Mon, May 20, 2019 at 02:32:39PM +0300, Matwey V. Kornilov wrote:

This patch series is to add support for spgist quadtree @<(point,circle)
operator. The first two patches are to refactor existing code before
implemention the new feature. The third commit is the actual implementation
provided with a set of simple unit tests.

Could you add that to the next commit fest please? Here you go:
https://commitfest.postgresql.org/23/

Done

Thank you for posting this patch. A took a look at it.

It appears that you make quadrant-based checks. But it seems to be
lossy in comparison with box-based checks. Let me explain this on the
example. Imagine centroids (0,1) and (1,0). Square (0,0)-(1,1) is
intersection of quadrant 2 of (0,1) and quadrant 4 of (1,0). And then
imagine circle with center in (2,2) of radius 1. It intersects with
both quadrants, but doesn't intersect with square.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company