Re: storing large graphs in postgres

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: "Taher H(dot) Haveliwala" <taherh24(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: storing large graphs in postgres
Date: 2001-09-06 15:28:49
Message-ID: Pine.BSF.4.21.0109060819260.93104-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 5 Sep 2001, Taher H. Haveliwala wrote:

> I need to store very large graphs structures in
> postgres. The graphs are close to 20GB when in
> flatfile format. I first tried using an adjacency
> list representation, i.e.,
>
> graph (source INT8 PRIMARY KEY, dest INT8[]);
>
> but operating on the array type seems a bit
> inflexible. I took a look at the contrib/array stuff
> as suggested in a previous post, but it seems like
> that only allows for boolean predicates on the array.
> I.e., I would like to be able to say 'return all nodes
> within distance two from x' using purely sql. Of
> course I could use an edge-list format:
>
> graph (source INT8, dest INT8);
>
> but this takes up almost double the space (which is
> painful, given that the original input is close to
> 20GB).
>
> Any way to get richer queries on array types, or some
> other efficient way to store large graphs?

You could probably write functions to do your operations
and then just use those from the sql queries.
If you use the C interface to make the functions the code
in contrib/array is probably a reasonable starting point to
look at.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-09-06 15:36:41 Re: update set from where... with count
Previous Message James F. Hranicky 2001-09-06 15:26:24 Re: Unexpected Behavior Using a Rule With Multiple Actions (Long)