Re: double linked list

From: --CELKO-- <71062.1056_at_compuserve.com>
Date: 1 Feb 2003 13:23:11 -0800
Message-ID: <c0d87ec0.0302011323.6b6e9e7f_at_posting.google.com>


>> Being a novice in SQL and after doing just a couple of days of
research on that matter ... <<

Another boss who will not pay for training :0!!

>> I got the impression that SQL hasn't yet evolved to that point to
provide simple to use keywords for these kind of problems. <<

SQL is a set oriented language, not a procedural language. You have to learn to model data in terms of sets and not sequences to use it.

>> Oracle 9i seems to have been progressed over 8i in this regard. <<

Actually, Oracle is a horrible product and their extensions are flaws that lock the code into a particular underlying sequential physical implementation with sorting and cursors, no parallelism, etc.

>> Currently I figure to use
 

   SELECT cs, cb, level
     FROM link_t
    START WITH cb

              IN (SELECT cb
                    FROM link_t
                   WHERE cs = 'A')

  CONNECT BY PRIOR cb = cs;

that will return a tree containing all paths with the root as the common starting point. <<

It returns a sequential file that represents a table and that represernation depends on the order of the records (they are no longer rows in a table).

>> I would load this structure into a middle tier and apply some sort
of commonly used tree traversial algorithm to it to search for nodes and endpoints of interest. <<

You can do all of those searches in the Nested Sets model with a single query, no middle ware and they will run 10 to 100 times faster for large trees.

I have a book on trees in SQL that will be published later this year that you might want to buy. Received on Sat Feb 01 2003 - 22:23:11 CET

Original text of this message