indexing of hierarchical data

From: Dado Feigenblatt <dado(at)wildbrain(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: indexing of hierarchical data
Date: 2001-07-06 23:15:46
Message-ID: 3B4646A2.9E02268B@wildbrain.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
We make cartoons here.
<br>But let's say we were working on 3 different Cop movies.
<br>Our projects are devided into project, sequence, and shot.
<p><tt>project&nbsp;&nbsp;&nbsp; sequence&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
shot</tt><tt></tt>
<p><tt>CopFilm1&nbsp;&nbsp; alley shooting&nbsp;&nbsp; death of the bad
guy</tt>
<br><tt>CopFilm2&nbsp;&nbsp; car chase&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
death of the bad guy</tt>
<br><tt>CopFilm3&nbsp;&nbsp; car chase&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
death of the bad guy</tt><tt></tt>
<p>At first I was indexing the shots just buy shot_ID (serial), and storing
the sequence_ID it belongs to.
<br>On the sequence record, I was storing the project_ID&nbsp;it belongs
to.
<p>So if I wanted to select <tt>CopFilm3, car chase, death of the bad guy</tt>
<br>I had to find the ID&nbsp;of the project <tt>CopFilm3</tt>, the ID&nbsp;of
the sequence <tt>car chase</tt> belonging to that project and then shot
<tt>death of the bad guy </tt>belonging to that sequence.
<br>As most of the operations happen at the shot level, for performance
reasons I think it might be better to store the project and sequence with
the shot, so I don't have to perform any joins.
<br>Also, projects and sequences have alphabetical codes assigned to them,
which is usually the prefered way of accessing the data.
<br>So, it is my impression that I should store those codes in the shot
as foreign keys with <tt>on update cascade</tt>
<br>should someone decide to rename projects and sequences, and their codes,
which happens.
<br>Is this approach ok or should I stick to serial ID's and make the lookups?
<br>Any comment on problems like this?
<p>Thanks.
<pre>--&nbsp;
Dado Feigenblatt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wild Brain, Inc.&nbsp;&nbsp;&nbsp;
Technical Director&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (415) 553-8000 x???
dado(at)wildbrain(dot)com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; San Francisco, CA.</pre>
&nbsp;</html>

Attachment Content-Type Size
unknown_filename text/html 2.4 KB

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-07-06 23:59:42 Re: indexing of hierarchical data
Previous Message Josh Berkus 2001-07-06 22:51:44 Re: creating variable views