[UPDATE] Slow Queries
-
so seems like this plugin is shelfed and abandoned by the developer, I reported the issue that it is taking too much time and quering is very slow because it was storing all visits as rows then counting those rows on every page visit to show total visitors.
$all_total_visitors = $wpdb->get_var("SELECT COUNT(*) FROM $visitors_stat ") + $initial_value;
This was the code which was causing 8 to 10 seconds depends on how many rows you have in that table.
I fixed it by changing some logics,
like instead of counting and then showing all visits, I used my own function to write total visitors into new column so when I get 100 visits, it shows 100 rows and in every row it shows total visitors column which equal to 100 in 100th row.
so now this logic aside I added a DELETE query to delete rows which are older than 1 day so live visits and today’s visits don’t get affected.
so now It is much faster, I still have to look at duplicate queries it is making for showing today and live visits.
- You must be logged in to reply to this topic.