Exemplo n.º 1
0
    $time_start = microtime(true);
    $result_insert = $db->insertBatchFiles('summing_url_views_big', $file_data_names, ['event_time', 'url_hash', 'site_id', 'views', 'v_00', 'v_55']);
    echo "use time:" . round(microtime(true) - $time_start, 2) . "\n";
    foreach ($result_insert as $fileName => $state) {
        echo "{$fileName} => " . json_encode($state->info_upload()) . "\n";
    }
    print_r($db->select('select sum(views) from summing_url_views_big')->rows());
    echo "----------------------------------------------------------------------------------------------------\n";
}
echo "php_ini.memory_limit = " . ini_get("memory_limit") . "\n";
ini_set("memory_limit", "1256M");
echo "php_ini.memory_limit = " . ini_get("memory_limit") . "\n";
memoryUsage::show();
$sql = 'select * from summing_url_views_big LIMIT 50000';
echo ">>> {$sql}\n";
$db->select($sql);
memoryUsage::show();
$rows = $db->select($sql)->rows();
memoryUsage::show('select rows');
unset($rows);
memoryUsage::show('unset rows ');
$rows = $db->select($sql)->rawData();
memoryUsage::show('rawData');
unset($rows);
memoryUsage::show('unset rows ');
$rows = $db->select($sql)->rawData(true);
memoryUsage::show('rawData');
unset($rows);
memoryUsage::show('unset rows ');
memoryUsage::showPeak();