Re: Graph datatype addition

From: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
To: Florian Pflug <fgp(at)phlo(dot)org>
Cc: Misa Simic <misa(dot)simic(at)gmail(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Graph datatype addition
Date: 2013-04-30 08:49:52
Message-ID: CAOeZVid-cbBPnc_mE4-csegjaVdqQxtHUfaYcSRoQVAsn-Y=fQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Usually though, you'd be interested a large graphs which include
> information for lots of records (e.g., nodes are individual users,
> or products, or whatever). A graph datatype is not well suited for
> that, because it'd store each graph as a single value, and updating
> the graph would mean rewriting that whole value. If you're e.g. doing
> social network analysis, and each new edge between two users requires
> you to pull the whole graph from disk, update it, and write it back,
> you'll probably hit problems once you reach a few hundred users or
> so… Which really isn't a lot for that kind of application.

Yes, I agree. Hence, I suggested keeping the nodes and links separate.
So, if you need to add a new edge, you just need to update the
adjacency lists.

What I think will work is more of a 'logical' graph i.e. Consider a
tuple in some table. To add it to a new/existing graph as a node, we
just need to add an adjacency list for it. For each edge that connects
the tuple to some other node, we add the corresponding entry in the
list.

Essentially, the idea is again, to separate the nodes and links,
hence, the actual node is accessed pretty infrequently as compared to
the links. Since they are separate, there is no need to pull out the
entire graph for updating a single edge. This was the fundamental
problem with my HStore based design.

Regards,

Atri

--
Regards,

Atri
l'apprenant

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2013-04-30 08:50:26 Re: [HACKERS] pgsql: Add sql_drop event for event triggers
Previous Message Simon Riggs 2013-04-30 05:57:27 Re: Substituting Checksum Algorithm (was: Enabling Checksums)