Renaming folder slow...
I have a folder that contains a hierarchy that includes some code, and about 10,000 cataloged objects; renaming that folder is really slow; I'm just curious if anyone knows why? Does the id of the folder have to be re-keyed in all of its children? Sean ========================= Sean Upton Senior Programmer/Analyst SignOnSanDiego.com The San Diego Union-Tribune 619.718.5241 sean.upton@uniontrib.com =========================
I have a folder that contains a hierarchy that includes some code, and about 10,000 cataloged objects; renaming that folder is really slow; I'm just curious if anyone knows why? Does the id of the folder have to be re-keyed in all of its children?
I am no expert in this, but I fear that it is even worse: The folder is physically COPIED to the new name ... (Try with a large folder. If I am right, the ZODB should have grown quite a bit after the rename.) WRT cataloging I don't actually know if the catalog checks for name changes. AFAIK it doesn't ... Joachim
Joachim Werner wrote:
I have a folder that contains a hierarchy that includes some code, and about 10,000 cataloged objects; renaming that folder is really slow; I'm just curious if anyone knows why? Does the id of the folder have to be re-keyed in all of its children?
I am no expert in this, but I fear that it is even worse: The folder is physically COPIED to the new name ... (Try with a large folder. If I am right, the ZODB should have grown quite a bit after the rename.)
WRT cataloging I don't actually know if the catalog checks for name changes. AFAIK it doesn't ...
Folders with several thousand objects should be implemented as BTree Folders. They are at least 5 times (probably more) faster than OFS:Folder. I assume it is because BTree Folders do not render all that extra info (date stamp, size etc.) into a table. HTH, -- Tim Cook, President - Free Practice Management, Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
btw: how do you programmatically rename some folder items? I started with this, but I'm a complete newbie. it doesn't work. import string, sys import ZODB, OFS.ObjectManager def main(folder='/path/to/Images'): '''Strip extensions (.gif, .jpg) from all images''' OFS.ObjectManager.checkValidId(OFS.ObjectManager,folder) get_transaction().begin() obj = OFS.ObjectManager._get_ob(folder) for img in obj.objectValues('Image'): new_id = img.id new_id = string.replace(new_id,'.gif','',1) new_id = string.replace(new_id,'.jpg','',1) new_id = string.replace(new_id,'.png','',1) if (new_id != img.id): img.manage_renameObject(img.id, new_id) get_transaction().commit() if __name__=='__main__': if len(sys.argv) > 1: main([sys.argv[1]]) else: main() sean.upton@uniontrib.com schrieb:
I have a folder that contains a hierarchy that includes some code, and about 10,000 cataloged objects; renaming that folder is really slow; I'm just curious if anyone knows why? Does the id of the folder have to be re-keyed in all of its children? -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/
participants (4)
-
Joachim Werner -
Reini Urban -
sean.upton@uniontrib.com -
Tim Cook