Closed thomaspiller closed 4 months ago
Option: add a button that displays on demand the statistics by country
After a bit of research on the results with EXPLAIN/ANALYZE, I was able to improve by 15 folds the speed of the query, by creating an index :
CREATE INDEX mx_logs_id_log_data_date_idx
ON mx_logs (id_log, (data #>> '{"id_view"}'), date_modified);
Added in prod and staging. If it's fast enough now, we can close this issue and I'll include that in the next migration script.
I think I found another bottleneck during the stats process, for popular views with thousands of activations. I will try to find another trick before closing.
This could come from the SQL query to generate the view reading stats. Another thing to look into is the change of cloud provider that occurred in early April. This should be investigated ASAP.