Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Make better use of the index on sessions table

Uku Taht941a91ec220a
diff --git a/lib/plausible/stats/base.ex b/lib/plausible/stats/base.ex
index 6cf84f0045..d59a741a88 100644
--- a/lib/plausible/stats/base.ex
+++ b/lib/plausible/stats/base.ex
@@ -127,7 +127,7 @@ defmodule Plausible.Stats.Base do
from(
s in "sessions",
where: s.domain == ^site.domain,
- where: s.timestamp >= ^first_datetime and s.start < ^last_datetime
+ where: s.start >= ^first_datetime and s.start < ^last_datetime
)
|> add_sample_hint(query)