pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jodi Kanter <jkanter@virginia.edu>
To: Postgres Admin List <pgsql-admin@postgresql.org>
Subject: [Fwd: binary tree query]
Date: Mon, 26 Jan 2004 14:16:13 -0500
Message-ID: <4015677D.3090808@virginia.edu> (raw)

I have a biochemist telling me that this query below is a typical one 
for crawling through a taxonomic tree and that this is how I should 
represent some peptide information we have. Is there anyone on this list 
familiar with such data? I am weak in the science department but this 
query looks like it might not be the most efficient approach.
I have not been able to run an explain analyze yet as the database 
structure and data are not in place yet. We are just in the planning 
stages right now.

Any comments, suggestions, concerns, etc. would be much appreciated. 
Would an experienced DBA recommend a different approach? Can anyone 
offer some insight into the usefulness of INNER joins and the use of 
BETWEEN? I am concernec about performance as well since I expect this 
table to get large.

SELECT count(*)
  FROM taxon_name
       INNER JOIN taxon AS tax_b USING(taxon_id)
       INNER JOIN taxon AS tax_v ON (tax_v.left_id BETWEEN 
tax_b.left_id AND tax_b.right_id )
       INNER JOIN annot ON (tax_v.taxon_id = annot.taxon_id)
       INNER JOIN protein ON (protein.prot_id= annot.prot_id)
 WHERE annot.pref = 1
   AND taxon_name.taxon_id=207245
;



Thanks,
Jodi

-- 

/_______________________________
//Jodi L Kanter
BioInformatics Database Administrator
University of Virginia
(434) 924-2846
jkanter@virginia.edu <mailto:jkanter@virginia.edu>/

 

/ /

/ /

view thread (3+ messages)  latest in thread

Message-ID: <4015677D.3090808@virginia.edu>
Permalink:  ../4015677D.3090808@virginia.edu/
Also on:    postgresql.org/message-id/4015677D.3090808@virginia.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: jkanter@virginia.edu
  Subject: Re: [Fwd: binary tree query]
  In-Reply-To: <4015677D.3090808@virginia.edu>
  References: <4015677D.3090808@virginia.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox