[wp-hackers] Restructuring Category Hierarchy

Omry Yadan omry at yadan.net
Tue May 8 04:47:07 GMT 2007

I am not sure I fully understand the the proposed implementation, but I
do understand that changes will happen over many queries.
be sure to do it inside a transatcion, else wierd things will happen if
you get an error when you are half done.

Jamie Talbot wrote:

> Otto wrote:
> > Took me a while to figure out just what the hell you were talking
> > about, but I get it now. You're basically talking about hierarchy in
> > the categories. And you're right, that is a more efficient way to do a
> > tree model. Selection of a whole branch basically becomes a simple
> > query. You get the left and right values of the category you want,
> > then select everything with left/right values between those two
> > values. Voila, you have all the children. The cost is that inserting a
> > category into the hierarchy requires an insert and 2 updates, while
> > deleting takes a delete and 3 updates. Not a huge deal, really.
> > The one thing that does concern me on that dev.mysql page is that they
> > talk about inserts and deletes, but they don't talk about rearranging
> > the hierarchy. A rearrangement is basically a delete followed by an
> > insert to another location, so you're looking at least 7 queries to do
> > it in the most obvious way. That seems really high.
> Though there may be a more optimised implementation than 7 queries,
> you're right that it is more
> complex.  However, I can't see this being a well-used feature in any
> case - I mean, I can see it for
>  making corrections, but not more than a few times.  Besides, if you
> call the process 'restructure
> category tree', or something, people will expect it to take a while. 
> After all of which, we're
> still talking varying degrees of milliseconds.
> It definitely will be slower to insert into this model than the
> existing one.  But, it definitely
> will be much quicker to select from it.  That's the kind of model I'd
> prefer for a critical part of
> the system, which is interacted with on pretty much every page load.
> Does anyone have real-world experience with this kind of technique,
> who can provide more insight?
> I'm still very keen to see this implemented.  What do core devs think
> of this?
> Cheers,
> Jamie.
wp-hackers mailing list
wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list