From: | Dmitry Tkach <dmitry(at)openratings(dot)com> |
---|---|
To: | fcanedo(at)hotpop(dot)com |
Cc: | pgsql-admin(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Btree index extension question |
Date: | 2002-03-15 23:37:27 |
Message-ID: | 3C9285B7.10203@openratings.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general pgsql-sql |
>
>
>
>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
From | Date | Subject | |
---|---|---|---|
Next Message | fcanedo | 2002-03-16 00:09:02 | Re: [GENERAL] Btree index extension question |
Previous Message | Dmitry Tkach | 2002-03-15 23:09:07 | Re: Btree index extension question |
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Tkach | 2002-03-15 23:41:47 | PL/pgSQL question |
Previous Message | Greg Sabino Mullane | 2002-03-15 23:37:08 | Re: Random Numbers/Letters |
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Tkach | 2002-03-15 23:41:47 | PL/pgSQL question |
Previous Message | Dmitry Tkach | 2002-03-15 23:09:07 | Re: Btree index extension question |