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

Why visit_first_action_time is not indexed in log_visit #13164

Closed
vzelen opened this issue Jul 12, 2018 · 3 comments
Closed

Why visit_first_action_time is not indexed in log_visit #13164

vzelen opened this issue Jul 12, 2018 · 3 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@vzelen
Copy link

vzelen commented Jul 12, 2018

Hi everyone,

Could you please let me know the reasons why "visit_first_action_time" is not a part of any index in log_visit table? This field, basically, represents the timestamp of a visit itself, e.g. one the most straightforward information of the tracking in common.

Is it safe to create the index on that field manually in order to speedup analytical queries?

Thank you a lot in advance.

@sgiehl
Copy link
Member

sgiehl commented Jul 16, 2018

Did you see any query that can be improved by adding an index on visit_first_action_time?

@vzelen
Copy link
Author

vzelen commented Jul 17, 2018

@sgiehl thank you for the response!
No, I'm not talking about matomo code itself.

My concern is about the usage of the database outside of piwik. It looks very obvious for me that the table that stores information about "visits" should allow us to fetch those visits when they were fired. Please let me know if my assumption is not reasonable?
Is it a bad practice to require that information from matomo in that way by fetching data from piwik_visit_log?

@tsteur
Copy link
Member

tsteur commented Jul 17, 2018

It is reasonable to use it for custom analysis. In Matomo, it was at some point decided to use the last action timestamp which is why there is an index for it and pretty much all queries use that index. In some cases, the first action time makes more sense for sure. For example the "visit by hour" report definitely should be using the first_action_time column. We're just not planning on adding another index which wouldn't be used by any of our reports as it would make the tracking slower and require more storage.

If you're doing some raw data analysis or writing some custom plugins feel free to add an index to your DB.

@Findus23 Findus23 added the answered For when a question was asked and we referred to forum or answered it. label May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

4 participants