[wp-hackers] Restructuring Category Hierarchy

Omry Yadan omry at yadan.net
Mon May 7 18:12:43 GMT 2007


Since manipulating the list is not an operation done frequently, I don't
think anything can be too expensive here.
the user wont notice if it takes 20ms or 2 seconds.

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.
>


More information about the wp-hackers mailing list