/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to classes/cache.php

  • Committer: Suren A. Chilingaryan
  • Date: 2018-03-23 03:25:36 UTC
  • Revision ID: csa@suren.me-20180323032536-r3nofczubbjlgmdv
Group INSERTs into the transactions for better INNODB performance

Show diffs side-by-side

added added

removed removed

Lines of Context:
214
214
 } 
215
215
 
216
216
 function FillCache($res, $start, $end, $optimize_empty, $subcall = false, $verbose = false) {
 
217
    global $ADEI_CONTINUOUS_TRANSACTION;
 
218
    
217
219
    if ($res === false) throw new ADEIException(translate("Invalid CACHE resolution"));
218
220
    
219
221
    $resolution = $this->resolution->GetWindowSize($res);
385
387
        $pretime  = $start;
386
388
        
387
389
        if ($subcall) {
 
390
            $start_transaction = true;
388
391
            foreach ($data as $time => $value) {
389
392
                if (sizeof($value) != $this->items) {
390
393
                    if (!sizeof($value)) continue;
395
398
 
396
399
                if ($time >= $this->current_raw_end) {
397
400
                    $query = $this->CreateQuery($table, $time, $value);
 
401
                    if ($start_transaction) {
 
402
                        $this->StartTransaction();
 
403
                        $start_transaction = false;
 
404
                    }
398
405
                    $this->Insert($resolution, $query);
399
406
                }
400
407
            
401
408
                $pretime = $time;
402
409
            }
 
410
            if (!$start_transaction) $this->Commit();
403
411
 
404
412
            $curdata->Finalize($end - $pretime);
405
413
        } else {