On Jul 13, 2008, at 1:47 PM, [EMAIL PROTECTED] wrote:
> > hi all > i have a tree/graph of nodes and links inbetween (= explicit m2m), and > many users can simultaneusly change nodes/links. > i need to get all-reachable-from-x in one query - so i'm saving also > all the paths (not just the immediate neibourghs). i think this was > called nested-sets or whatever. > The question is, (how) can i do that concurency-safe. > is version_id a viable/usable solution (can it happen that some poor > guy is never able to save his stuff as others always overtake him)? > nested sets is awful for concurrency since any node additions or deletions require a full UPDATE of at least half the table's rows. But when you say "saving all the paths" that sounds more like materialized path. Which I haven't used in a super long time but also would require many large UPDATEs if the tree structure is changing. Depending on what kind of performance you need you can maybe lock the whole table, or queue all the updates/deletes into a single thread/ process..otherwise you might want to look into decreasing the amount of interdependent rows if you want to use version_id or row locking. These are just guesses though without much deep thought put into it. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---