Consider running overnight job for this. And doing the grouping and summarising in PHP, not MySQL. I have several similar statistics jobs at the office and what I do is generate an overnight larger table and process it separately, filling out a "stats" table.there are some issues:
2. when website doesnt respond for short time - usually something is taking resources in mysql. Long query needed for statistics, for example I disabled to show downloaded subtitles per user. I got it database, but it takes long time to filter all downloads from HUGE download table(s)
Like eduo said, caching is the way to resolve all heavy queries. There are quite a few free frameworks for caching available in PHP out there, many of them are quite easy to implement if opensubtitles is object oriented2. when website doesnt respond for short time - usually something is taking resources in mysql. Long query needed for statistics, for example I disabled to show downloaded subtitles per user. I got it database, but it takes long time to filter all downloads from HUGE download table(s)
OS uses a lot of caching already. This is more than caching, it's changing the way some queries are made so they run on a separate "thread" than the site's requests.Like eduo said, caching is the way to resolve all heavy queries. There are quite a few free frameworks for caching available in PHP out there, many of them are quite easy to implement if opensubtitles is object oriented2. when website doesnt respond for short time - usually something is taking resources in mysql. Long query needed for statistics, for example I disabled to show downloaded subtitles per user. I got it database, but it takes long time to filter all downloads from HUGE download table(s)
I'm aware of that, but last time I checked the user statistics it was calculated on the fly, this was a couple of months ago though...OS uses a lot of caching already. This is more than caching, it's changing the way some queries are made so they run on a separate "thread" than the site's requests.
Users browsing this forum: No registered users and 103 guests