NYCPHP Meetup

NYPHP.org

[nycphp-talk] Building trees

Cliff Hirsch cliff at pinestream.com
Thu Jul 27 02:07:05 EDT 2006


I use this structure and find it to be very effective for reads. Just
remember to use InnoDB for updates as a crash during an update can
corrupt the entire table structure. Also remember that it can be very
inefficient for writes if you have a very large table and are
manipulating nodes. 

-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Rob Marscher
Sent: Wednesday, July 26, 2006 7:11 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Building trees

Maybe try using a modified preorder tree.  This article explains it in 
MySQL/PHP terms - 
<http://www.sitepoint.com/article/hierarchical-data-database/2>.  If you

organize your tree that way, it will prevent the need for recusion.  The

only downside is it's more difficult to understand and requires more 
queries when adding new nodes because you have to update the numbering 
for the other nodes.  But I recommend it.

FYI, nyphp-mysql is a special list for MySQL related PHP topics - 
<http://lists.nyphp.org/mailman/listinfo/mysql>

-Rob




More information about the talk mailing list