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

Build in "OPTIMIZE" statement? #853

Closed
anonymous-matomo-user opened this issue Jul 6, 2009 · 6 comments
Closed

Build in "OPTIMIZE" statement? #853

anonymous-matomo-user opened this issue Jul 6, 2009 · 6 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Milestone

Comments

@anonymous-matomo-user
Copy link

My Piwik database is 5.9MB big and I've got an overhead of 1.1MB. How about implementing an "OPTIMIZE" routine in Piwik to avoid getting a huge overhead?
Keywords: outofscope

@mattab
Copy link
Member

mattab commented Jul 7, 2009

What tables have overhead?

if they are piwik_archive_* tables, we could probably add an OPTIMIZE statement around the postCompute method at: https://github.com/piwik/piwik/blob/master/core/ArchiveProcessing/Period.php#L280

@robocoder
Copy link
Contributor

Do we know how this overhead changes as the database increases? Is it closer to a constant (e.g., 1.1MB), percentage (e.g., 18%), exponential, or logarithmic?

@mattab
Copy link
Member

mattab commented Jul 7, 2009

If the overhead is on the piwik_log_archive (which I suspect it is), then I believe the overhead is linearly proportional to the number of deleted rows by the query in https://github.com/piwik/piwik/blob/master/core/ArchiveProcessing/Period.php#L280 which itself is learnly proportional to the frequency at which archives are done for the Piwik install (if cron is installed or not, etc.).

OPTIMIZE is probably costly to run, but the DELETE are also ran only once a day maximum, so we might be OK running the OPTIMIZE just after these DELETEs. Or we could run it every week or so (every sunday eg.) in this same code path.

@anonymous-matomo-user
Copy link
Author

An OPTIMIZE run may be issued on an entire database by "mysqlcheck -o <db>", which can be put in crontab. I guess it might be enough to put this in the FAQ.

@halfdan
Copy link
Member

halfdan commented Apr 29, 2010

I think it's enough to put this into FAQ. Including this into the core will make it more complicated to implement other database backends in future (OPTIMIZE is MySQL specific).

@robocoder
Copy link
Contributor

The DBStats plugin is already backend-specific.

@anonymous-matomo-user anonymous-matomo-user added this to the Piwik 0.6.1 milestone Jul 8, 2014
@mattab mattab removed the wontfix label Aug 3, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

4 participants