On Wed, 16 Aug 2006, Gerhard Killesreiter wrote:
Dries Buytaert wrote:
On 15 Aug 2006, at 15:00, Gerhard Killesreiter wrote:
I can only guess why these tables were chosen: they have a lot of writes. Locking would only be an issue for the cache table.
And the variables table.
Modules that frequently use variable_get()/variable_set() to store temporary results can bring your site to halt. variable_set() requires 4 SQL queries, and does a table lock that is likely to stall other Apache clients. :-)
Who writes such modules? The only place that variable_set should be used is on admin pages.
</lurk> Why not keep a global array of variables changed during the current request, and persist them during cleanup, instead of locking the table and persisting a single variable during each variable_set call? That would make doing multiple variable_sets in one request about as expensive as a single call to variable_set, as well as providing atomicity for multiple variables tweaked in one request. <lurk>