Re: Nested Sets vs. Nested Intervals

From: Vadim Tropashko <vadimtro_invalid_at_yahoo.com>
Date: 16 Nov 2005 14:15:18 -0800
Message-ID: <1132179318.081003.318960_at_z14g2000cwz.googlegroups.com>


asdf wrote:
> I use this method:
>
>
> CREATE TABLE `web_directory` (
> `id` int(8) unsigned NOT NULL auto_increment,
> `parent` int(8) unsigned NOT NULL default '0',
> `name` varchar(100) NOT NULL default '',
> PRIMARY KEY (`id`),
> KEY `name` (`name`),
> KEY `parent` (`parent`)
> );
>
> ...
>
> SELECT id
> FROM web_directory
> WHERE name = 'Web Chess Viewers'
> AND parent = (
>
> SELECT id
> FROM web_directory
> WHERE name = 'Software'
> AND parent = (
>
> SELECT id
> FROM web_directory
> WHERE name = 'Chess'
> AND parent = (
>
> SELECT id
> FROM web_directory
> WHERE name = 'Abstract'
> AND parent = (
>
> SELECT id
> FROM web_directory
> WHERE name = 'Board Games'
> AND parent = (
>
> SELECT id
> FROM web_directory
> WHERE parent =0
> AND name = 'Games'
> LIMIT 1
> )
> LIMIT 1
> )
> LIMIT 1
> )
> LIMIT 1
> )
> LIMIT 1
> )
> LIMIT 1
This is adjacency relation. Your (dynamically constructed) query is efficient.

> What are the speed advantages of a web directory built from LDAP be
> faster than SQL.

Maybe. SQL advantage is flexibility:
"Report all the users with the count of the number of folders they created in the last 24 hours"
Try writing this in LDAP. Received on Wed Nov 16 2005 - 23:15:18 CET

Original text of this message