Forum OpenACS Q&A: Response to A starting work to manage translations and locations (addresses)

DAG = Directed Acyclic Graph. Trees are a subset of this class of graph.

The datamodel's very simple, as described above, it's all the queries to do exactly what I need that are hairy. The datamodel's roughly just something like:

create table locales (
    locale_id integer primary key
);

create table contains (
     smaller integer references locales,
     bigger integer references locales
);

create index smaller_idx on contains(smaller);
create index bigger_idx on contains(bigger);
I may have a "primary key(bigger, smaller)" to enforce uniqueness and then just a separate index on "smaller", I don't remember offhand. I need indexed access on both fields, the composite index/primary key only gets me indexed access on "bigger".