On Nov 30, 12:31 am, Carl Meyer <c...@oddbird.net> wrote: > > Now, this is not that inefficient - but it would be a good > > optimization to NOT fetch the instances if there are no listeners for > > pre/post delete signals and there are no cascades (or all cascades are > > DO_NOTHING). Even if there are cascades, you could fetch just PKs of the > > to-be deleted models (even that is not actually needed, as you can use > > joins) > > Yes, these would be possible optimizations (in the no-listeners case). > They would break the admin's delete-confirmation screen, so we'd have to > be willing to accept a regression in functionality there, or else > duplicate the delete-cascade logic in the admin (leaving open more > possibilities for the delete-confirmation screen to not tell the truth), > in order to make these optimizations. > > In the case of many cascade-deleted objects, bulk delete performance in > 1.3 is already much better than it was in any previous Django release. > If something even closer to the metal is needed (besides the ability to > write raw SQL deletes), I'd prefer to see new raw-bulk-delete API added > rather than QuerySet.delete() made less functional in order to be > faster. I think there might even be a ticket for that already...
I should not have said that this would be a good optimization, and used the possible optimizations wording. I haven't got any performance problems when using delete in 1.3. So from my point of view the above mentioned optimization is mostly a theoretical possibility. I did not mean the 1.3 version of deletion is bad at all. If dependent object collection could be made a public API (with the possibility of fetching all dependencies to depth N, not just cascaded dependencies), it would be a nice feature for sure. If just the cascades part would be made public, it would be great, too. Showing "these objects will be deleted" confirmation page is not a feature only admin needs. - Anssi -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.