Skip to content
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

[RFC] Add monthly stats #60

Open
HLeithner opened this issue May 2, 2021 · 3 comments
Open

[RFC] Add monthly stats #60

HLeithner opened this issue May 2, 2021 · 3 comments

Comments

@HLeithner
Copy link
Member

Since our stats are not really useful to get up to date information about Joomla usage I would suggest to generate the following reports.

Monthly php/cms/db Version (maybe db_type and server_os too) considering only the last 90 days. Generating this in real time is too time consuming (at least with my tests but a history should be available anyway).

I thought about something similar to a table structure based on jos_jstats_content_db_type. Creating a new table jos_jstats_history_db_type and adding the year and the month should be enough (of course adding the right indexes).

Based on the work done by @alikon #43 (which actually doesn't work on our stats server because mysql is not able to handle 1,5m rows without a proper index and even with index it doesn't like to use it, adding a hint doesn't help either) we can create a cron job with an simple REPLACE query like REPLACE #__js_jstats_content_db_type (year, month, db_type, count) VALUES(YEAR(NOW()), MONTH(NOW()), '$sqltype', '$count') based on the result of something like this

SELECT db_type, count(*) as count FROM (
  SELECT * FROM `jos_jstats` use index(idx_modified) WHERE modified > DATE_SUB(NOW(), INTERVAL 90 DAY)
) tmptable group by db_type`

(using a temp table here because mysql doesn't like to use the index, I have to check the reason for this maybe it's the group by clause or someone else can enlighten me)

We can add the last 6 month or so on the stats https://developer.joomla.org/about/stats.html

Any comment is welcome.

@zero-24
Copy link

zero-24 commented May 4, 2021

Sounds like a good plan to me. 👍

@alikon
Copy link

alikon commented May 4, 2021

is Redis available on that server ?

@HLeithner
Copy link
Member Author

@alikon do we need it? I mean we need the history anyway and if we update a mysql server or but the data into redis doesn't make a big different especially if want to keep it anyway.

Btw. @richard67 helped me debugging your query and it seems mysql doesn't use index if the selected column is not part of the index. So it seems that the instant view is the best to do it but still to slow for real time and also not needed in my opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants