Hi,
The query that counts uniq_visitors for a week is running for several days on my server and I was wondering why it is not summed by the daily tables.
Then I found the codes below:
piwik/core/ArchiveProcessing/Period.php
...
if($name == 'nb_uniq_visitors') continue;
...
if(!Piwik::isUniqueVisitorsEnabled($this->period->getLabel()))
{
unset($results['nb_uniq_visitors']);
}
foreach($results as $name => $value)
{
if($name == 'nb_uniq_visitors')
{
$value = (float) $this->computeNbUniqVisitors();
}
$this->insertRecord($name, $value);
}
and further in same page:
/**
* Processes number of unique visitors for the given period
*
* This is the only metric we process from the logs directly,
* since unique visitors cannot be summed like other metrics.
*
* @return int
*/
protected function computeNbUniqVisitors()
{
$select = "count(distinct log_visit.idvisitor) as nb_uniq_visitors";
$from = "log_visit";
$where = "log_visit.visit_last_action_time >= ?
AND log_visit.visit_last_action_time <= ?
AND log_visit.idsite = ?";
$bind = array($this->getStartDatetimeUTC(), $this->getEndDatetimeUTC(), $this->idsite);
$query = $this->getSegment()->getSelectQuery($select, $from, $where, $bind);
return Zend_Registry::get('db')->fetchOne($query['sql'], $query['bind']);
}
My problem is, my server just can’t processes so many data and give it back to php. So, what happens if I comment that code and leave the uniq_visitors sum work as all the other metrics ?