@tsteur opened this Pull Request on March 9th 2015 Owner

fixes #6758

We do only display the number of visits and actions in the Real time widget so let's only request those. This should make it very fast as we can avoid the visitors counter which is slow. Eg the visitors counter takes a few seconds on many million rows whereas the visits counter standalone takes maybe 0.05 seconds if at all. If someone uses the API it will be still "slow" on a very large instance.

Adding a separate query for visits and visitors shouldn't make a huge difference as the visitors one is so slow compared to the visits one.

In the actual "Live counter" widget we do only request the last 3 minutes were we shouldn't have any problem with the unique visitors counter as MYSQL will choose a different index automatically.

I added another tweak: If visits is 0 we can assume that all other counters are 0 as well so we do not execute any further query at all. We can assume this as we request the last_action_time so we should be sure there was no further action etc.

@mattab commented on March 11th 2015 Owner

Looks good to me! :+1:

This Pull Request was closed on March 11th 2015
Powered by GitHub Issue Mirror