View Source Plausible.Stats.QueryOptimizer (Plausible v0.0.1)
Methods to manipulate Query for business logic reasons before building an ecto query.
Summary
Functions
This module manipulates an existing query, updating it according to business logic.
Splits a query into event and sessions subcomponents as not all metrics can be queried from a single table.
Functions
This module manipulates an existing query, updating it according to business logic.
For example, it:
- Figures out what the right granularity to group by time is
- Adds a missing order_by clause to a query
- Updating "time" dimension in order_by to the right granularity
- Updates event:hostname filters to also apply on visit level for sane results.
- Removes revenue metrics from dashboard queries if not requested, present or unavailable for the site.
Splits a query into event and sessions subcomponents as not all metrics can be queried from a single table.
event:page dimension is treated in a special way, doing a breakdown of visit:entry_page for sessions.