diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-06-27 22:16:53 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-06-27 22:26:59 +0200 |
commit | 5704a49c7908cef401d23879f32013f90d2e7878 (patch) | |
tree | a87a5c5637701ebf575a86825b15f010801784c9 /schema.sql | |
parent | e86deffd9c387f0912eb392cf23cb08aa3ea4c1e (diff) |
server: Ensure db queries are all indexed
Diffstat (limited to 'schema.sql')
-rw-r--r-- | schema.sql | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -17,6 +17,7 @@ create table Members ( foreign key(room) references Rooms(id) on delete cascade, foreign key(user) references Users(id) on delete cascade ); +create index members_user_index on Members(user); create table Users ( id integer primary key not null, @@ -34,7 +35,7 @@ create table Messages ( foreign key(room) references Rooms(id) on delete cascade, foreign key(user) references Users(id) on delete set null ); -create index messages_time_index on Messages(time); +create index messages_time_index on Messages(room, time desc); create table Firebase ( user integer not null, |