From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Greg Stark <stark(at)mit(dot)edu> |
Cc: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Erik Rijkers <er(at)xs4all(dot)nl>, Emanuel Calvo <3manuek(at)esdebian(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Nicolas Barbier <nicolas(dot)barbier(at)gmail(dot)com>, Claudio Freire <klaussfreire(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: BRIN indexes - TRAP: BadArgument |
Date: | 2014-11-10 21:26:03 |
Message-ID: | 20141110212603.GJ1791@alvin.alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Greg Stark wrote:
> On Sun, Nov 9, 2014 at 5:57 PM, Greg Stark <stark(at)mit(dot)edu> wrote:
> > 2) The mention about additional opclass operators and to number them
> > from 11 up is fine -- but there's no explanation of how to decide what
> > operators need to be explicitly added like that. Specifically I gather
> > from reading minmax that = is handled internally by Brin and you only
> > need to add any other operators aside from = ? Is that right?
>
> I see I totally misunderstood the use of the opclass procedure
> functions. I think I understand now but just to be sure -- If I can
> only handle BTEqualStrategyNumber keys then is it adequate to just
> define the opclass containing only the equality operator?
Yes.
I agree that this deserves some more documentation. In a nutshell, the
opclass must provide three separate groups of items:
1. the mandatory support functions, opcInfo, addValue, Union,
Consistent. opcInfo is invoked each time the index is accessed
(including during index creation).
2. the additional support functions; normally these are called from
within addValue, Consistent, Union. For minmax, what we provide is the
functions that implement the inequality operators for the type, that is
< <= => and >. Since minmax tries to be generic and support a whole lot
of types, this is the way that the mandatory support functions know what
functions to call to compare two given values. If the opclass is
specific to one data type, you might not need anything here; or perhaps
you have other ways to figure out a hash function to call, etc.
3. the operators. We only use these so that the optimizer picks up the
index for queries.
> Somehow I got confused between the amprocs that minmax uses to
> implement the consistency function and the amops that the brin index
> supports.
I think it is somewhat confusing, yeah.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2014-11-10 21:31:23 | Re: BRIN indexes - TRAP: BadArgument |
Previous Message | Alvaro Herrera | 2014-11-10 21:15:52 | Re: BRIN indexes - TRAP: BadArgument |