Проверенный хостинг для Simple TDS. Там все работает.
BugFix
- Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии
Precondinion
There are more then one sid, out* in a tds
Condition
Daily stat page getting when a sid (out*) filter is set
Issue
In each output row in stat grid there are stats for ALL sids even if the sid (out*) filter is set
Quick fix
stats_daily.php page. Just added $where into $qu2 evaluation
while ($line = mysql_fetch_array($result)) {
$datt = $line['dat'];
$qu2 = "SELECT COUNT(ip) as hits, COUNT(DISTINCT ip) as unics FROM `stats` WHERE dt>='$datt 00:00:00' AND dt<='$datt 23:59:59' $where";
echo "$qu2<br>";
$result2 = mysql_query($qu2);
------------------------------------------------------
Кстати, просто не могу не удержатся от очень! серйозного замечание по перформансу
Firstly, you select
SELECT LEFT(dt,10) as dat FROM `stats` WHERE 1 AND (`sid`='8' ) GROUP BY dat
all days according to filters.
Then, for each day a nested loop is executed. LIke this one after the fix
SELECT COUNT(ip) as hits, COUNT(DISTINCT ip) as unics FROM `stats` WHERE dt>='{day} 00:00:00' AND dt<='{day} 23:59:59' AND (`sid`='8' )
Cause there are not any indexes on stat table, it will be full table scan operation per each nested loop
You can use
SELECT COUNT(ip) as hits, COUNT(DISTINCT ip) as unics, LEFT(dt,10) as dat FROM `stats`WHERE (`sid`='8' ) //$wheregroup by LEFT(dt,10)order by dat or to make stats table clastered (BUT NOT NEW INDEX!) by dt (like preordering on insert), if possible in MySql?As I have never worked with PHP and MySql, would be glad to see this improventent implemented in future release.
Thanks a mill for TDS!
Наконец то пошли багфиксы. Я крайне рад. =) Спасибо тебе неизвестный человек с непонятным ником =) We`ll see this fix in next release =)