Re: Composite Index Structure - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Composite Index Structure
Date
Msg-id 4D748337.6030700@enterprisedb.com
Whole thread Raw
In response to Composite Index Structure  (Nick Raj <nickrajjain@gmail.com>)
Responses Re: Composite Index Structure
List pgsql-hackers
On 07.03.2011 08:07, Nick Raj wrote:
> I want to construct an "Composite Index Structure" i.e. a combination of
> gist and btree.
> What i am thinking is that first creating a Rtree structure that is pointing
> to another Btree structure.
> For example, Suppose i want to find vehicles between 2 to 4 pm on 14/2/2011
> on X road.
>
> I am thinking of creating rtree structure for road network and then btree
> for time. For reaching X road i use Rtree, and from there btree begin i.e.
> leaf node of rtree contains the pointer to root node of btree ( in this way
> i have all time belonging to X road)
>
> My question is that how to implement this composite index structure in
> postgres?
>
> Let us suppose, if i create mygist index, then i have to write my own
> operator class?
> or
> can i use gist index as it is and btree tree as it is. I mean their operator
> class and their gist methods but how to establish linkage between them?

It sounds like a use case for a multi-column gist index. See btree_gist 
contrib module. You'll want something like:

CREATE INDEX ... USING gist (coordinates, time)

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Nick Raj
Date:
Subject: Composite Index Structure
Next
From: Heikki Linnakangas
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Efficient transaction-controlled synchronous replication.