From cfcc08c4791a262a94840bff6b65a4cf6775f4a6 Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Tue, 2 May 2023 21:59:31 +0200 Subject: [PATCH] Adding indexes with the hope to increase performance in /stats. --- lib/BurguillosInfo/DB/Migrations.pm | 1 + templates/metrics/stats.html.ep | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/BurguillosInfo/DB/Migrations.pm b/lib/BurguillosInfo/DB/Migrations.pm index 4d95f9f..0bfb85f 100644 --- a/lib/BurguillosInfo/DB/Migrations.pm +++ b/lib/BurguillosInfo/DB/Migrations.pm @@ -28,6 +28,7 @@ sub MIGRATIONS { 'ALTER TABLE paths ADD column last_seen TIMESTAMP;', 'ALTER TABLE paths ALTER COLUMN last_seen SET DEFAULT NOW();', 'ALTER TABLE requests ADD PRIMARY KEY (uuid)', + 'CREATE INDEX request_extra_index on requests (date, path);', ); } 1; diff --git a/templates/metrics/stats.html.ep b/templates/metrics/stats.html.ep index 38ca8d2..4c0ef7d 100644 --- a/templates/metrics/stats.html.ep +++ b/templates/metrics/stats.html.ep @@ -1,4 +1,5 @@ % layout 'stats'; +% my $base_url = config 'base_url';

Stats

@@ -14,7 +15,7 @@ % for my $row (@$tracking_by_url) { - <%=$row->{path}%> + <%="${base_url}$row->{path}"%> <%=$row->{unique_ips_last_24_hours}%> <%=$row->{unique_ips_last_week}%> <%=$row->{unique_ips_last_month}%>