Re: 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: Re: GIST optimization to limit calls to operator on sub nodes
Date: 2014-06-30 07:40:00
Message-ID: 53B11450.2010001@realfusio.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


Le 29/06/2014 22:30, Tom Lane a écrit :
> Emre Hasegeli <emre(at)hasegeli(dot)com> writes:
>> Pujol Mathieu <mathieu(dot)pujol(at)realfusio(dot)com>:
>>> 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.
>> I do not think it is possible at the moment. The GiST framework can
>> be extended to support this use case. I am not sure about the
>> speedup. Most of the consistent functions do not seem very expensive
>> compared to other operations of the GiST framework. I would be
>> happy to test it, if you would implement.
> I don't actually understand what's being requested here that the
> NotConsistent case doesn't already cover.
>
> regards, tom lane
>
>
Hi,
The NotConsistent case is correctly covered, the sub nodes are not
tested because I know that no child could pass the consistent_test.
The MaybeConsistent case is also correctly covered, all sub nodes are
tested because I don't know which sub nodes will pass the consistent_test.
My problem is with the FullyConsistent, because when I test a node I can
know that all it's childs nodes and leaves will pass the test, so I want
to notify GIST framework that it can't skip consistent test on those
nodes. Like we can notify it when testing a leaf that it could skip
consistent test on the row. Maybe I miss something on the API to do
that. On my tests, the "recheck_flag" works only for leaves.
Thanks
Mathieu

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Craig Ringer 2014-06-30 09:24:55 Volatility - docs vs behaviour?
Previous Message Niels Kristian Schjødt 2014-06-30 07:33:10 Re: Guidelines on best indexing strategy for varying searches on 20+ columns