GIST optimization to limit calls to operator on sub nodes

From: Pujol Mathieu <mathieu(dot)pujol(at)realfusio(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: GIST optimization to limit calls to operator on sub nodes
Date: 2014-06-23 07:20:39
Message-ID: 53A7D547.5080302@realfusio.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello,
I already post my question in the General Mailing list, but without
succeed so I try this one that seems to me more specialized.
My question is about GIST index.
I made my own index to handle specific data and operators. It works
pretty fine but I wonder if it was possible to optimize it.
When I run my operator on a GIST node (in the method
gist_range_consistent) it returns "NotConsistent" / "MaybeConsistent" /
"FullyConsistent".
NotConsistent -> means that all subnodes could be ignored,
gist_range_consistent return false
MaybeConsistent -> means that at least one subnode/leaf will be
consistent, gist_range_consistent return true
FullyConsistent -> means that all subnodes/leaves will be consistent,
gist_range_consistent return true

So like with the "recheck flag" I would like to know if there is a way
to notify postgres that it is not necessary to rerun my operator on
subnodes, to speedup the search.

For example, consider the following gist tree
R
/ \
Na Nb
/ \ / \
La1 La2 Lb1 Lb2

If all nodes return FullyConsistent, postgres will run tests in that
Order : R, Na, Nb, La1, La2, Lb1, Lb2, thanks to recheck flag it will
not test rows associated to leaves Lxx.
My goal is that postgres run test on R and then skip tests on other
nodes. So is there a way to do that in the GIST API ? Or could I share
data from R to Nx and then From Na to Lax and Nb to Lbx ?
Thanks,
Mathieu

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message tim_wilson 2014-06-24 00:39:47 Re: autovacuum vacuum creates bad statistics for planner when it log index scans: 0
Previous Message Tomas Vondra 2014-06-20 10:14:16 Re: huge pgstat.stat file on PostgreSQL 8.3.24