The bug comments suggest wrapping the subquery in "select * from (...)"
to materialize the subquery only once. I've attached a patch that does
that. Let me know whether it helps or hurts. Note that this isn't the
final form of the patch since the other supported databases don't need
this hack, but if it helps, I'll apply it to the MySQL adapter only.
Excellent! Prepack now takes a few minutes instead of hours.
The patch triggered this Mysql error: "Every derived table must have its
own alias", so I adjusted it a bit (attached).
--- common.py (revision 86976)
+++ common.py (working copy)
@@ -592,9 +592,11 @@
UPDATE pack_object SET keep = %(TRUE)s
WHERE keep = %(FALSE)s
AND zoid IN (
+ SELECT * FROM (
SELECT DISTINCT to_zoid
JOIN temp_pack_visit USING (zoid)
+ ) as zoid_table
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org