We can mirror the optimizations brought by #457080: Add node_delete_multiple().
This means making the following hooks multiple :
hook_field_storage_delete() (only this one currently has an actual implementation in core)
hook_field_delete()
hook_field_attach_delete()

Comments

bjaspan’s picture

I request holding off on this until #367753: Bulk deletion is closed.

I also wonder why we would bother with this at all. Sure, maybe we *can* make deletes into a multiple operation, but why introduce the extra complexity?

catch’s picture

As in the node_delete_multiple() case - if you bulk delete 50 nodes, each of those has ten fields, then at the moment you're looking at 500 queries just from Field API - whereas you'd have 10 (?) queries if field_attach_delete() is multiple.

However there's a few issues with this - only node has a multiple delete, we don't know if other fieldable objects will or not. Also hook_node_delete() has stayed singular so far - not sure if moshe has plans to change that.

moshe weitzman’s picture

Comments are about to get multiple delete. I would move multiple delete all the wway to hook_node_delete() if folks think it is important. I don't think thats relevant for this patch though. field_attach does not listen on that hook.

Fast deletion is really important in the case of retrying data migrations. It can also be important for ephemeral data like research datasets, web services datasets, etc. I agree it isn't *that* important for most people, but when you need it, you need it bad.

stephencamilo’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)
hestenet’s picture

Status: Closed (won't fix) » Active

Reset issue status.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.