On 2005-04-26, "TJ O'Donnell" <[EMAIL PROTECTED]> wrote: > But I think I might be able to do better (faster) using R-trees. > Bitstrings can be thought of as "containing" when one bitstring has all the > same bits set as another, even if it has other bits set too - this is the > gist of the first where-clause above. > > Can I expect to be able to use R-tree's to do this?
You may want to use GIST instead - it is more flexible. > Will I simply have to define a new datatype and three R-tree functions > (union, intersection and size). > Will the use of the ~ (contains) operator cause the planner to consider > using an index (this is my first question, way above)? What the planner actually looks for is, having identified the specific operator and types, whether an index opclass exists for them, and if so whether an index using that opclass exists. The actual names of the operators are irrelevent. So for either rtree or GIST, all you need is to define your new datatype, with its associated operators, and create an operator class for it with appropriate support functions, and create indexes using that opclass. Once all that is done, the planner will consider using them. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster