From 4bd2c5b1772f328c98390fe7fb1dc1f0c44a8060 Mon Sep 17 00:00:00 2001 From: Howon Lee <hlee.howon@gmail.com> Date: Tue, 19 Oct 2021 11:46:06 -0700 Subject: [PATCH] Audit cards data display problem (#18527) Underlying problem was that the cardinality of dates were getting limited by the default 1000 limit imposed by EE queries. Whack it for this specific instance. I think if we see it ever again we just remove the 1000 limit instead. --- .../src/metabase_enterprise/audit_app/pages/users.clj | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/enterprise/backend/src/metabase_enterprise/audit_app/pages/users.clj b/enterprise/backend/src/metabase_enterprise/audit_app/pages/users.clj index 00e7b00c9d0..9a6622a667e 100644 --- a/enterprise/backend/src/metabase_enterprise/audit_app/pages/users.clj +++ b/enterprise/backend/src/metabase_enterprise/audit_app/pages/users.clj @@ -6,6 +6,8 @@ [ring.util.codec :as codec] [schema.core :as s])) +(def ^:private ^:const date-cardinality-limit 25000) + ;; DEPRECATED Query that returns data for a two-series timeseries: the number of DAU (a User is considered active for ;; purposes of this query if they ran at least one query that day), and total number of queries ran. Broken out by ;; day. @@ -40,13 +42,15 @@ {:select [[(common/grouped-datetime datetime-unit :started_at) :date] [:%distinct-count.executor_id :count]] :from [:query_execution] - :group-by [(common/grouped-datetime datetime-unit :started_at)]}) + :group-by [(common/grouped-datetime datetime-unit :started_at)] + :limit date-cardinality-limit}) date->active (zipmap (map :date active) (map :count active)) new (common/query {:select [[(common/grouped-datetime datetime-unit :date_joined) :date] [:%count.* :count]] :from [:core_user] - :group-by [(common/grouped-datetime datetime-unit :date_joined)]}) + :group-by [(common/grouped-datetime datetime-unit :date_joined)] + :limit date-cardinality-limit}) date->new (zipmap (map :date new) (map :count new)) all-dates (sort (keep identity (distinct (concat (keys date->active) (keys date->new)))))] -- GitLab