Nested Sets Insertion
From: Enu <ewiner_at_adelphia.net>
Date: Sat, 10 May 2003 21:19:52 GMT
Message-ID: <r1rqbvkskot712c1ll39bdn8upcc411hmp_at_4ax.com>
I'm making some forum software using PHP and MySQL that's quite a bit like a Usenet group (i.e. threads). The data won't change much, and the program is very dependent on being able to count the number of descendants of any post (which is very slow with adjacency tables), so I want to use nested sets. Still, for when a post is added directly into the tree, I haven't been able to find any optimized examples of how to do this. I'm sure there's some sort of spiffy mathematical solution of INSERT and UPDATE statements that can append a child to a node and update the left and right values of the affected nodes. Could somebody point me in the right direction? Thanks! Received on Sat May 10 2003 - 23:19:52 CEST
Date: Sat, 10 May 2003 21:19:52 GMT
Message-ID: <r1rqbvkskot712c1ll39bdn8upcc411hmp_at_4ax.com>
I'm making some forum software using PHP and MySQL that's quite a bit like a Usenet group (i.e. threads). The data won't change much, and the program is very dependent on being able to count the number of descendants of any post (which is very slow with adjacency tables), so I want to use nested sets. Still, for when a post is added directly into the tree, I haven't been able to find any optimized examples of how to do this. I'm sure there's some sort of spiffy mathematical solution of INSERT and UPDATE statements that can append a child to a node and update the left and right values of the affected nodes. Could somebody point me in the right direction? Thanks! Received on Sat May 10 2003 - 23:19:52 CEST