Adding indexes with the hope to increase performance in /stats.

This commit is contained in:
sergiotarxz 2023-05-02 21:59:31 +02:00
parent c50df91a5a
commit cfcc08c479
2 changed files with 3 additions and 1 deletions

View File

@ -28,6 +28,7 @@ sub MIGRATIONS {
'ALTER TABLE paths ADD column last_seen TIMESTAMP;', 'ALTER TABLE paths ADD column last_seen TIMESTAMP;',
'ALTER TABLE paths ALTER COLUMN last_seen SET DEFAULT NOW();', 'ALTER TABLE paths ALTER COLUMN last_seen SET DEFAULT NOW();',
'ALTER TABLE requests ADD PRIMARY KEY (uuid)', 'ALTER TABLE requests ADD PRIMARY KEY (uuid)',
'CREATE INDEX request_extra_index on requests (date, path);',
); );
} }
1; 1;

View File

@ -1,4 +1,5 @@
% layout 'stats'; % layout 'stats';
% my $base_url = config 'base_url';
<div class="description"> <div class="description">
<h2>Stats</h2> <h2>Stats</h2>
@ -14,7 +15,7 @@
</tr> </tr>
% for my $row (@$tracking_by_url) { % for my $row (@$tracking_by_url) {
<tr> <tr>
<td><%=$row->{path}%></td> <td><%="${base_url}$row->{path}"%></td>
<td><%=$row->{unique_ips_last_24_hours}%></td> <td><%=$row->{unique_ips_last_24_hours}%></td>
<td><%=$row->{unique_ips_last_week}%></td> <td><%=$row->{unique_ips_last_week}%></td>
<td><%=$row->{unique_ips_last_month}%></td> <td><%=$row->{unique_ips_last_month}%></td>