Notifications
Clear all

wp_sw_statistics issue

10 Posts
3 Users
0 Reactions
20.1 K Views
(@anzwers)
Customer Customer
Joined: 9 years ago
Posts: 21
Topic starter  

Hi, as you know the wp_sw_statistics tables continues to grow, no problem if a blog has few posts and accesses but for big site, sooner or later, this table will slow down the site.

For this reason I think it is important to add an option, something like:

Aggregate data:

a) never
b) Now all (from the beginning)
c) every month (automatic)
d) every quarter (automatic)
e) every half-year (automatic)
f) every year (automatic)

Well, let's say I choose the option e), What should happen?

This is now a query for the post 96:

548     96     1     2016-01-20
589     96     1     2016-01-22
1460     96     1     2016-03-12
1650     96     1     2016-03-21
3357     96     2     2016-04-12
4335     96     1     2016-04-22
5110     96     1     2016-04-24
5370     96     1     2016-04-25
6866     96     2     2016-05-01
7239     96     1     2016-05-02
7543     96     1     2016-05-03
7798     96     1     2016-05-04
9155     96     1     2016-05-07
9601     96     1     2016-05-09
11626     96     1     2016-05-14
11809     96     1     2016-05-15
12555     96     1     2016-05-18
15452     96     1     2016-05-26
17190     96     1     2016-06-03
19461     96     1     2016-06-10
19814     96     1     2016-06-11
25718     96     1     2016-06-29

32385     96     1     2016-07-14
33336     96     1     2016-07-16
37794     96     1     2016-07-25
41344     96     1     2016-08-02
42602     96     6     2016-08-06
42872     96     4     2016-08-07
43189     96     3     2016-08-08
43862     96     1     2016-08-09
44356     96     3     2016-08-10

but after the automatic "aggregate" starting the 1 July the result will be:

32385     96     1     2016-07-14
33336     96     1     2016-07-16
37794     96     1     2016-07-25
41344     96     1     2016-08-02
42602     96     6     2016-08-06
42872     96     4     2016-08-07
43189     96     3     2016-08-08
43862     96     1     2016-08-09
44356     96     3     2016-08-10

44357   96     24     2016-06-30

and after the automatic "aggregate" starting the 1 January (for the last 6 months) the result will be:

    44357   96     24     2016-06-30
    64656   96     134    2016-12-31

In a few words:

You know a range of date (for example from 1 gen to 31 march)
You made a query for the first post in that range and count the accesses
You sum the accesses
You delete all the records for the post in that range and replace them with only 1 record dated the last day of the range:  12256   1     13434    2016-03-31
You process the next post and so on.

And the statistics for authors and post wil be always accurate, because no one cares how many accesses had made on 23 April two years ago...
Let me know what you think about, thank you.

Augusto


   
Quote
(@anzwers)
Customer Customer
Joined: 9 years ago
Posts: 21
Topic starter  

PS: instead to open another topic I use this one because the issue is similar.

I see that the my wp_sw_ips has in this moment 83K records... 83k IPs.
But they should not be deleted every 24 hours?

Why save a ip 9 months ago?
Thank you!

 

 


   
ReplyQuote
(@varos)
Estimable Member
Joined: 8 years ago
Posts: 141
 

Augusto,

In the widgets there are a lot of options, so if you need to see the last 3 month you can do that, also, there is custom filter for custom date. Please take a look.


   
ReplyQuote
(@anzwers)
Customer Customer
Joined: 9 years ago
Posts: 21
Topic starter  

Hi,

please have you carefully read my topics?
The statistics are PERFECT, so let's start from the second question: why save all the IPs if the plugin "considers" only 1 day to count visits?
Thank you.

Augusto

 

 


   
ReplyQuote
 Tom
(@tomson)
Famed Member Admin
Joined: 10 years ago
Posts: 4213
 

Hi Augusto,

you may want to change the logging time-frame, so it'll not work if we remove IPs. This IP archive is designed for all time-frames not only for one day logging. If you want to remove logging information you can use APSW log clear in settings page. Just choose the from/to dates and delete.


   
ReplyQuote
(@anzwers)
Customer Customer
Joined: 9 years ago
Posts: 21
Topic starter  

Thank you dear Tom for your reply, but please could you explain to me (my english is not so good) what do you mean when you say: "This IP archive is designed for all time-frames not only for one day logging"?

If I have understood the plugin counts a new visit only if a specific IP is new in the 24 hours and it does not matter if the day before the same IP has visited the same post, of course I am talking about the wp_sw_ips table... where I am wrong?

Augusto

 

 


   
ReplyQuote
 Tom
(@tomson)
Famed Member Admin
Joined: 10 years ago
Posts: 4213
 

I meant, that APSW has different options for time period, it can be 1 year, 1 month, 1 week and 1 day. Some day you may need to use for example the "1 year" option and it'll work fine because we have all IP logging for all times. If we remove and only keep the last one day, then the new time period options will not work. We are not sure that someday you'll not change the time period to "1 year" or "1 month".


   
ReplyQuote
(@anzwers)
Customer Customer
Joined: 9 years ago
Posts: 21
Topic starter  

Tom tells me if I have understood.

This is the settting for my widget for Popular users:

apsw

so if I delete all the IPs, before today, the widget will not count correctly anymore?

If the answer is yes then I ask you why you don't use the wp_sw_statistics table to do this count. You have all the accesses for every post and you know who writes the post...

I am not saying that the plugin does not work, what I say is that every day, day by day, the sites with this plugin will slow down. Or if you prefer I am saying that a site with 10k visitors a day is dead with APSW.

If you think this is not correct, please tell me way.
Thank you!

Augusto

 


   
ReplyQuote
(@varos)
Estimable Member
Joined: 8 years ago
Posts: 141
 

Augusto, Please note: 10k rows for MySQL is not a problem at all.


   
ReplyQuote
(@anzwers)
Customer Customer
Joined: 9 years ago
Posts: 21
Topic starter  

I know dear Tom, but in one year they are over 3.000.000 rows... and this only for 1 table...


   
ReplyQuote
(@anzwers)
Customer Customer
Joined: 9 years ago
Posts: 21
Topic starter  

Hi Tom, I discover now that you use the _ips table also to count the total views (under posts) instead of the _statistics, so if I delete the IPS I loose all the visits under post.
Am I right?

Thank you.

Augusto


   
ReplyQuote
Share:
Scroll to top