indexing of hierarchical data - Mailing list pgsql-sql

From Dado Feigenblatt
Subject indexing of hierarchical data
Date
Msg-id 3B4646A2.9E02268B@wildbrain.com
Whole thread Raw
Responses Re: indexing of hierarchical data
List pgsql-sql
We make cartoons here. <br />But let's say we were working on 3 different Cop movies. <br />Our projects are devided
intoproject, sequence, and shot. <p><tt>project    sequence         shot</tt><tt></tt><p><tt>CopFilm1   alley
shooting  death of the bad guy</tt><br /><tt>CopFilm2   car chase        death of the bad guy</tt><br /><tt>CopFilm3  
carchase        death of the bad guy</tt><tt></tt><p>At first I was indexing the shots just buy shot_ID (serial), and
storingthe sequence_ID it belongs to. <br />On the sequence record, I was storing the project_ID it belongs to. <p>So
ifI wanted to select <tt>CopFilm3, car chase, death of the bad guy</tt><br />I had to find the ID of the project
<tt>CopFilm3</tt>,the ID of the sequence <tt>car chase</tt> belonging to that project and then shot <tt>death of the
badguy </tt>belonging to that sequence. <br />As most of the operations happen at the shot level, for performance
reasonsI 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
accessingthe data. <br />So, it is my impression that I should store those codes in the shot as foreign keys with
<tt>onupdate 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>-- 
 
Dado Feigenblatt                                 Wild Brain, Inc.   
Technical Director                               (415) 553-8000 x???
dado@wildbrain.com                               San Francisco, CA.</pre>  

pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: creating variable views
Next
From: "Josh Berkus"
Date:
Subject: Re: indexing of hierarchical data