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

Do not perform an inner join when looking for archives to purge, it does not scale. #8331

Merged
merged 1 commit into from Jul 12, 2015

Conversation

diosmosis
Copy link
Member

One user's install appears to become bloated due the INNER JOIN in Piwik\DataAccess\Model::getInvalidatedArchiveIdsSafeToDelete(). The user has more than one hundred thousand invalid archives. On this install, the query never finished (I let it run for an hour before stopping), and for some reason, the scheduled task that purges invalidated archives returns immediately with an empty result set.

The query I've replaced it w/ takes ~.7s to run when there are ~135,000 invalid archives in a single table.

It's possible this may fix #7181, after fixing this in the user's Piwik, the scheduled task started working. Currently waiting for verification.

…his can make Piwik completely unresponsive and can result in invalidated archives never being purged.
@diosmosis diosmosis added the Bug For errors / faults / flaws / inconsistencies etc. label Jul 12, 2015
@diosmosis diosmosis self-assigned this Jul 12, 2015
@diosmosis diosmosis added this to the 2.14.1 milestone Jul 12, 2015
@mattab mattab modified the milestones: 2.15.0, 2.14.1 Jul 12, 2015
@mattab
Copy link
Member

mattab commented Jul 12, 2015

Very nice! I learnt something new about the Power of GROUP_CONCAT.

Note: this code is covered by System test: ArchivePurgerTest

mattab pushed a commit that referenced this pull request Jul 12, 2015
Do not perform an inner join when looking for archives to purge, it does not scale.
@mattab mattab merged commit 319e457 into master Jul 12, 2015
@mattab
Copy link
Member

mattab commented Jul 12, 2015

Great find @diosmosis 👍

@diosmosis diosmosis deleted the archive_purge_no_join branch July 12, 2015 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants