|
Posted by Jerry Stuckle on 02/04/07 10:36
R. Rajesh Jeba Anbiah wrote:
> On Feb 2, 5:58 am, "Phil Latio" <phil.la...@f-in-stupid.co.uk> wrote:
>> Let's say I have a simple web application running with just two MySQL
>> tables. The tables structure is as follows:
> <snip>
>> As you can see Batley, Leeds and Bradford are sub-categories of West
>> Yorkshire which itself is a sub-category of England.
>>
>> What I want to display when I am browsing through sub-categories of links is
>> not only the name of that sub-category but it's category's parents, grand
>> parents and so on like the below example.
>>
>> UK >> West Yorkshire >> Batley
> <snip>
>
> Answer is Nested Set Model architecture <http://dev.mysql.com/
> tech-resources/articles/hierarchical-data.html>
>
> --
> <?php echo 'Just another PHP saint'; ?>
> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
>
Not really. I've used nested sets before. They're find if the data is
static and/or the tables small. But dynamic data can be a real PITA to
manage, especially when the tables grow.
For instance, if you need to add a new entry to the bottom left node,
you potentially would have to renumber over 90% of the nodes in your table.
This is glossed over very lightly in the discussion itself. The fact
is, with a large table, it can be very costly to update all of those nodes.
Recursive SQL is much better. And it can be emulated in stored procedures.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|