aboutsummaryrefslogtreecommitdiff
path: root/sqlite/z-003-character-deaths-indexes.sql
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-10-27 21:44:13 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-10-27 21:44:13 -0300
commit6aa13394a12c1931990b91e62210cba72706920d (patch)
treed5a101e234cd7af61dc6d4573e897a1b4454410c /sqlite/z-003-character-deaths-indexes.sql
parent27a0df43b33b712462ab5be65462162b9e4bcd29 (diff)
downloadquerymanager-6aa13394a12c1931990b91e62210cba72706920d.tar.gz
querymanager-6aa13394a12c1931990b91e62210cba72706920d.zip
adjust character death indexes for common queries
Diffstat (limited to 'sqlite/z-003-character-deaths-indexes.sql')
-rw-r--r--sqlite/z-003-character-deaths-indexes.sql17
1 files changed, 17 insertions, 0 deletions
diff --git a/sqlite/z-003-character-deaths-indexes.sql b/sqlite/z-003-character-deaths-indexes.sql
new file mode 100644
index 0000000..9f4baf9
--- /dev/null
+++ b/sqlite/z-003-character-deaths-indexes.sql
@@ -0,0 +1,17 @@
+-- NOTE(fusion): This file contains index adjustments for the `CharacterDeaths`
+-- table. It is not strictly necessary as there are no modified tables but should
+-- help with queries such as the most recent deaths/kills from a specific character
+-- or overall.
+-- It can be executed automatically as a patch if placed at `sqlite/patches`. For
+-- more details see `sqlite/README.txt`. The changes are already present in the
+-- latest `schema.sql`, so trying to apply them on a newly created database will
+-- result in errors.
+--==============================================================================
+
+DROP INDEX CharacterDeathsCharacterIndex;
+DROP INDEX CharacterDeathsOffenderIndex;
+
+CREATE INDEX CharacterDeathsCharacterIndex ON CharacterDeaths(CharacterID, Timestamp);
+CREATE INDEX CharacterDeathsOffenderIndex ON CharacterDeaths(OffenderID, Timestamp);
+CREATE INDEX CharacterDeathsTimeIndex ON CharacterDeaths(Timestamp);
+