[Cubicweb] Entity deletion is slow

Yann Cointepas yann at cointepas.net
Fri Aug 29 10:37:31 CEST 2014


I have a database with 309 862 entities of type ScoreValue (from medicalexp
cube). As shown below, accessing these entities takes less than 3 seconds
but deleting them takes more than 23 minutes. I did the same test after I
removed as many hooks as possible (cube without dependencies, copied only
the entities I need from other cubes, removed all "composite" in relations)
but there is no difference. I would appreciate to understand why is it so
slow. And if there is a solution to speed-ud entity deletion it would be

I discovered this problem because I have several studies in my brainomics
based instance and sometimes I need to remove completely one study to
restart the script that populate the instance. I use a simple query 'DELETE
Any X WHERE X belong_to S, S name "MEMENTO"' (belong_to is a relation I
added to manage permissions). I focused on ScoreValue just to have a simple
example but I would like to speed-up the deletion of the whole study.

$ echo 'print len(rql("ScoreValue X"))' > /tmp/print.py
$ echo 'print len(rql("DELETE ScoreValue X"))' > /tmp/delete.py
$ time cubicweb-ctl shell catiweb /tmp/print.py

real    0m2.980s
user    0m2.663s
sys    0m0.162s
$ time cubicweb-ctl shell catiweb /tmp/delete.py

real    23m54.980s
user    18m25.589s
sys    0m39.386s


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20140829/99409d63/attachment-0185.html>

More information about the Cubicweb mailing list