Re: How to transform flat structure into hierarchical one?

Subject: Re: How to transform flat structure into hierarchical one?
From: "Steve Muench" <smuench@xxxxxxxxxxxxx>
Date: Thu, 8 Jun 2000 08:00:33 -0700
| Unfortunately, Steve discovered this *after* 
| Mike Kay's book came out.  I have added a special note
| to my copy at the bottom of page 560 to help
| remind me to use the Muenchian technique 
| instead whenever I have a grouping problem to solve.


I bumped into this idea while writing up a section in
my forthcoming book on Building Oracle XML Applications
for O'Reilly, where I was trying to understand and
subsequently explain the cases where using the database
to do the data "shaping"/grouping was best and where
doing a single query and allowing XSLT to do the grouping
was best.

The data "shaping" techniques supported in Microsoft ADO
and in Oracle using nested CURSOR() expressions end up
achieving the result using many individual data cursors and
trips across the networks. Depending on the amount of
data this might be too much network traffic. The XSLT grouping
approach can be better in some scenarios when doing a single
query to join a master and a detail table doesn't result in
tons of duplicated data.

So, given a trivial example like a DEPT and an EMP table...

If you want to include just a little information 
(like Dept Name) from the DEPT table, then it's probably
better to join DEPT and EMP and let XSLT "group" the joined
data. This is especially true if there are hundreds or
thousands of employees. 

If instead you need 30 columns of information from DEPT
and 30 columns of info from EMP, then joining them will
produce lots of redundant DEPT info. In that case it's
better to let the DB to the data shaping to deliver an
XML document that pre-grouped into departments.

Steve Muench, Lead XML Evangelist & Consulting Product Manager
Business Components for Java & XSQL Servlet Development Teams
Oracle Rep to the W3C XSL Working Group
Author "Building Oracle XML Applications", O'Reilly, Oct 2000

 XSL-List info and archive:

Current Thread