Attached patch does the following:
Removes cache_clear_all() from node_save() and moves it to node_submit()
Stops deleting node access grants for nodes that don't even exist yet.
It does not duplicate the field cache clear changes from #757288: Optimize comment_save() which removes 10% of the queries. Just making a note of it here in case that other patch gets held up.
devel generate, 100 pages.
Before:
Executed 1046 queries in 1003.7 ms.
After:
Executed 842 queries in 519.24 ms.
I'm also eyeing the db_update() in there suspiciously, seems like we could use db_next_id() instead, not tried patching for that yet though.
Comments
Comment #1
catchvid is a serial, so db_next_id() is pointless/not relevant, and db_last_insert_id() no longer exists in D7. So I'm sticking with this for now.
Comment #2
moshe weitzman commentedbriefer: $delete = $op == 'insert'. no need for ternary.
Comment #3
catchAck of course. Fixed.
Comment #4
moshe weitzman commentedCode and logic look good.
Comment #5
dries commentedCommitted to CVS HEAD. Thanks.
Comment #6
catchSlight whoopsie here, we only want to delete existing records if updating, not deleting. This would actually mess stuff up so bumping priority.
Comment #7
moshe weitzman commentedComment #8
dries commentedCommitted to CVS HEAD. Thanks.
Comment #10
pdrake commentedHere is a backport of this patch to D6.
Comment #11
pdrake commentedThe above patch is the correct patch for D6 - this one is only for those running pressflow and is posted here for reference/testing purposes.
Comment #12
pdrake commentedPatch for pressflow in #11 is bad. Here's a better pressflow patch.
Comment #13
mdupontNice but not critical
Comment #14
mdupontI'm not sure about moving cache_clear_all() out of node_save(). There can be plenty of existing code that assumes node_save() is doing a cache_clear_all() and moving it to node_submit() may break it.
Comment #15
hefox commentedThe cache clear all could conflict with any using node_save to save a single node outside of node submit
The grant access conflicts if acquire grants got called for whatever reason during 'insert' (Actually had some code doing it, one was a bug the other was due needing a draggable view to recalculate based on new node :/).
edit: forgot to finish first sentance
Comment #16
Praveen Sharma commentedRemoving cache_clear_all() increase the node_save time, but this impact the multisite installations.
Also, when the existing node is revised, old values might appear on the node view if cache_clear_all is removed.
Comment #17
pdrake commented@peeje, to be clear, cache_clear_all() is not completely removed in this patch, just moved from node_save to the node form submission handler, as in D7. Old values will not appear on the node view unless you are saving nodes in another manner and not clearing cache after doing so.