Page 1 of 1
Performance issue with serendipity_referrers
Posted: Sun Mar 28, 2010 3:36 pm
by ads
Hi,
the table "serendipity_referrers" contains all referrers which ever visited a blog. During performance analysis of my blog i found out, that the runtime for this query:
Code: Select all
SELECT scheme, host, SUM(count) AS total
FROM serendipity_referrers
GROUP BY scheme, host
ORDER BY total DESC, host
LIMIT 10
is constantly increasing, because this query has to scan the whole table each and every time. That's bad
Can this query somehow modified to not scan the whole table but instead use an index?
Re: Performance issue with serendipity_referrers
Posted: Mon Mar 29, 2010 9:34 am
by garvinhicking
Hi!
AFAIK a full table scan is required due to the "SUM(count)", so it cannot be sped up with an index. You could delete old referrers though:
DELETE FROM serendipity_referrers WHERE day <= (unix timestamp of the day you want all earlier entries be removed)
HTH,
Garvin
Re: Performance issue with serendipity_referrers
Posted: Mon Mar 29, 2010 12:25 pm
by ads
Yes, of course, i could do that. But this only fixes the problem for my blog - and i don't have a very high number of visitors. The same problem applies to every s9y blog so it would make sense to find a general solution.
What about a regular (cron)job which removes old entries, based on some configuration settings in the blog?
Re: Performance issue with serendipity_referrers
Posted: Mon Mar 29, 2010 3:29 pm
by Don Chambers
How about turning off the option to enable referrer tracking?
Re: Performance issue with serendipity_referrers
Posted: Mon Mar 29, 2010 3:31 pm
by ads
Dom Chambers: you asked this question to me?
Re: Performance issue with serendipity_referrers
Posted: Mon Mar 29, 2010 3:49 pm
by Don Chambers
ads wrote:Dom Chambers: you asked this question to me?
Yes, sorry. My suggestion is only valid if you do not need the info. I have personally never found any significant benefit from this particular table, so I always disable the configuration option which enables referrer tracking. I presume this eliminates the query, but have never looked at the code to be certain.
Re: Performance issue with serendipity_referrers
Posted: Mon Mar 29, 2010 4:24 pm
by ads
I want this feature enabled. But scanning through all old rows seems useless.
Re: Performance issue with serendipity_referrers
Posted: Mon Mar 29, 2010 7:26 pm
by garvinhicking
Hi!
Currently, there are a few tasks that you need to perform on s9y database tables that no plugin currently does. Most importantly, truncating spamblocklog tables, referrers and visitors.
I'd appreciate if someone wants to develop a maintenance plugin; I even believe someone did a rough work on that a few months ago, but I haven't heard of any final results...
A cronjob is hard because most s9y users do not know how to set one up, and tasks that can take up a long time most probably won't work with the s9y crontab plugin...
Regards,
Garvin
Re: Performance issue with serendipity_referrers
Posted: Mon Mar 29, 2010 7:52 pm
by ads
Added to my basket.
Let's see, how deep i can dive into the s9y code ...
Re: Performance issue with serendipity_referrers
Posted: Mon Mar 29, 2010 7:58 pm
by onli
I made such a plugin. Not a cronjob, but a cleanup on click:
http://board.s9y.org/viewtopic.php?f=10 ... ndb#p92554
If there is demand, I'd enhance it if necessary if someone tests it (I did on my system and it worked), introduce it on the plugin-system and eventually upload it to spartacus.
Re: Performance issue with serendipity_referrers
Posted: Mon Mar 29, 2010 8:14 pm
by ads
Some configuration settings would be nice, also a way to call this script from cron (like the update checker for the plugins).
I would love to test this.
Re: Performance issue with serendipity_referrers
Posted: Fri Apr 02, 2010 12:38 pm
by onli
Hi
Improved it a bit - added the referrers-table and made the tables to clean selectable. What's missing is the cronjob, maybe a better optical design, and a configurable timespan of entries not to be deleted. Anything else?
I won't work on it over the long weekend, so thought it's a good time to show the latest version and get your feedback. Are tables missing, working so far for you? You probably are able to help with the sql
