New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot show monthly evolution for cities (seems too slow/inefficient) #10782
Comments
Hello @cyberbeat - thanks for the report. do you also experience this problem on demo.piwik.org or is it working well there? |
On demo.piwik.org there are only 23 cities. I have hundreds of cities alone for germany. So this is not comparable. I would create own sql tables for this, piwik would be much faster: type (user_city, user_region, ..), id (city-id/region-id/..), year, month, day, visits,.. and it could even be aggregated with day=0 / month = 0 As for now, for piwik to lookup a monthly history for a city, it has to read many blobs "UserCountry_city", loop all hundrets of city-entries of the array in each blob, find the right city, and do the same for the next blob. |
Seems to work well on the demo on monthly data where we have about 2000 unique cities. See for example: http://demo.piwik.org/index.php?module=CoreHome&action=index&idSite=7&period=day&date=yesterday&updated=2#?idSite=7&period=week&date=2017-02-18&category=General_Visitors&subcategory=UserCountry_SubmenuLocations&popover=RowAction$3ARowEvolution$3AUserCountry.getCity$3A$257B$257D$3A$40Vienna$252C$2520Wien$252C$2520Austria Loads in 5-6 seconds. likely we can't make this much better at this stage |
This took around 20 seconds for me each for two tries with different cities (period=day): And you may have not a low budget vserver like me, and default-php-timeoutlimits will apply a few seconds later. I have switched to another solution in the meantime because of this. |
It's true that now it also takes 15-20s here. I'll reopen then |
I have a medium traffic website, and I'd like to see the monthly evolution data for each city:
piwik/index.php?date=2016-10-23&apiMethod=UserCountry.getCity&label=%40MyCity%252C%2520MyRegion%252C%2520MyCountry&disableLink=1&module=CoreHome&action=getRowEvolutionPopover&colors=%7B%22backgroundColor%22%3A%22%23ffffff%22%2C%22lineColor%22%3A%22%23162c4a%22%2C%22minPointColor%22%3A%22%23ff7f7f%22%2C%22maxPointColor%22%3A%22%2375bf7c%22%2C%22lastPointColor%22%3A%22%2355aaff%22%7D&idSite=1&period=month
The data does not load. It seems, that it is poor indexed, or too much data is archived.
I tried to look through the piwik code, and noticed:
a) the archived blobs for the usercountry-plugin are not indexed by city-label
b) in my case, there are over 2000 cities in each monthly-blob, so trying to show the standard view evolution for the last ~12 months for one city, more than 24000 rows have to be examined, right?
Perhaps it would be a good idea to limit the rows in the user-country-archiver plugin? Like
$maximumRowsInDataTableLevelZero = 100
$columnToSortByBeforeTruncation = 'nb_visits',
Or are there other ways to optimize these api queries?
The text was updated successfully, but these errors were encountered: