From: Dmitry Tkach <dmitry@openratings.com>
To: fcanedo@hotpop.com
Cc: pgsql-admin@postgresql.org
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: Btree index extension question
Date: Fri, 15 Mar 2002 18:37:27 -0500
Message-ID: <3C9285B7.10203@openratings.com> (raw)
References: <Pine.LNX.4.33.0203152249490.965-100000@icarus.hades>
>
>
>
>SELECT * FROM table where (bitstring & 7) = 7;
>
>Will this not give you the correct answer and use the index on bitstring?
>
Yes, and know... (Yes, it will give th ecorrect answer, and NO it will
not use the index).
The thing is, that it will only use a (btree) index for one of the
'comparison' operators
(<=, <, =, >, >=), that compare the value in the table with the query
parameter - so,
bitstring = 7, or bitstring < 7 etc... will work, but
'do_something_to_bitstring = 7' will not (I mean, it will, but it won't
use the index).
So, the idea is to redefine those comparison operators for the index, so
that I could use one of them fopr my purpose - for example (as I
mentioned in the original message), I was trying to define a '<<='
("less or equals") operator as a <<= b iff a & b = a.
My problem is that (as far as I understand) the way I am doing it will
not work (my set of operators doesn't define a strict ordering, so that
not any pair of values is comparable) :-(
And what I am looking for is either a suggestion of how this strict
ordering can be defined, or a description of what exactly the btree
needs to work (I suspect, that completely strict ordering is not really
necesssary, and that I could get away with some kind of a partial order,
if I new exactly what the btree stuff is looking for)...
Dima
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dmitry@openratings.com, fcanedo@hotpop.com, pgsql-admin@postgresql.org, pgsql-general@postgresql.org
Subject: Re: Btree index extension question
In-Reply-To: <3C9285B7.10203@openratings.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox