optimize squad info request

This commit is contained in:
norohind 2021-12-17 23:31:25 +03:00
parent 1302582a80
commit 79dbb49c17
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1
2 changed files with 7 additions and 3 deletions

View File

@ -10,10 +10,12 @@ squads_by_tag_extended_raw_keys = """select
null_fdev(super_power_name) as super_power_name,
null_fdev(faction_name) as faction_name,
user_tags,
inserted_timestamp,
max(inserted_timestamp) as inserted_timestamp,
squad_id
from squads_view
where tag = :tag
from squads_states
where tag = :tag
and squad_id not in (select squad_id from squads_states where tag is null)
group by platform
order by platform;
"""

View File

@ -37,6 +37,8 @@ current_season_aegis_score int,
previous_season_aegis_score int,
inserted_timestamp datetime default current_timestamp);
create index if not exists idx_squads_states_1 on squads_states (tag) where tag is null; --for squads_by_tag_extended_raw_keys req
create view if not exists squads_view
as
select squad_id,