MySql: 0.0000 s s, 0 request(s), PHP: 0.0349 s s, total: 0.0349 s s, document retrieved from database. MySql: 0.0000 s s, 0 request(s), PHP: 0.0166 s s, total: 0.0166 s s, document retrieved from cache.
[...] The queries executed through xPDO take no longer than queries through the mysql extension[...]
1. Call using xPDO (4.16797 sec)
$start = microtime(true);
$path = $modx->getOption('core_path') . 'components/ourpath/';
$result = $modx->addPackage('ourpath',$path . 'model/','xyz_');
$database = $modx->getCollection('datas', array('timestamp:>' => $startoftheyear, 'confirmed:!=' => ''));
$count = count($database);
echo "Since beginning of the year: ".$count;
$end = microtime(true);
$runtime = $end-$start;
echo "xPDO: ".$runtime." seconds ";
2. Call using mysql_query (0.00474 sec)
$start = microtime(true);
$server = ...;
$user = ...;
$password = ...;
$table = ...;
$connection = mysql_connect($server, $user, $password) or die ("no connection");
mysql_select_db($table) or die ("table doesn´t exist");
$SQL1="SELECT * FROM datas WHERE confirmed!='' AND timestamp>'$startoftheyear'";
$result1=mysql_query($SQL1);
$count = mysql_num_rows($result1);
$end = microtime(true);
$runtime = $end-$start;
echo "Since the beginning of the year: ".$count;
echo "Runtime mysql_query: ".$runtime." seconds ";