Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #2 on: Aug 11, 2006, 10:59:39 am »
yes, I delete one time a month the records which are older then 12 month, I see that this is the problem...
I read this data also vor statistics is this a reason that the whole thing will slow down?
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #3 on: Aug 11, 2006, 11:01:51 am »
for example this query need several records to execute 300.000 records
SELECT ip_country.country AS variable, COUNT(*) AS value FROM visits AS tbl LEFT JOIN ip2nationCountries AS ip_country ON ip_country.code = tbl.country WHERE tbl.country <> ''
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #4 on: Aug 11, 2006, 11:04:57 am »
The reason for slow down is that you use grouping functions when you show up the stats.
The why to do this faster is JOIN most of those data with other tables. Eg. the referer and the client fields.
But the real way to do this fast is to use some form of caching like awstats do, because in any way the parsing of this data is a slow process....
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #5 on: Aug 11, 2006, 11:17:04 am »
yes that's true the sql statement wasn't complete:
SELECT ip_country.country AS variable, COUNT(*) AS value FROM visits AS tbl LEFT JOIN ip2nationCountries AS ip_country ON ip_country.code = tbl.country WHERE tbl.country <> '' AND hostname = 'www.finalwebsites.com' GROUP BY tbl.country ORDER BY value DESC LIMIT 0, 10
I'm using group, but how to optimize the table with joins I have only two tables...
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #6 on: Aug 11, 2006, 11:24:35 am »
You have to split it to more tables...
And you can start by the hostname. Insted of using the actual hostname you will use the id of it in the hostnames (index that field)
Actually that was the reason that I stop developing my statistics program....