public function counterMultiple(array $cids, $increment, $default = 0) {
// TODO: This can be implemented in a batched way (with just one query)
// and counter() should call counterMultiple(). But again the crippled
// Drupal's DTBNG is brilliantly doing it's job.
foreach ($cids as $cid) {
$this->counter($cid, $increment, $default);
}
}
Performance of tag storage when using the database backend could be orders of magnitude better if a good implementation of counterMultiple() was present.
Comments
Comment #2
david_garcia commentedComment #3
david_garcia commentedWhat this basically needs is to expand the Upsert in DBTNG to allow expressions on updates and default values on inserts (while keeping this BC....)
This is the current code:
And this is what a batched version of this code should look like...
The secret sauce is in adding an optional parameter to the Values() method of upsert queries that is able to take a different set of values when doing an update. The problem is that there is no way to distinguish between expressions and values. On inserts there is no point in supporting expressions because there is no previous dataset. Maybe something like this.... but it's too ugly.
Comment #4
fabianx commentedTagging as a contrib project blocker.
Need to support this in all 3 DB engines.