Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add desc indexes to optimize desc query #72

Merged
merged 1 commit into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker-compose.gatling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ services:
- 5432:5432
networks:
- fide_api
command: postgres -c shared_preload_libraries=pg_stat_statements -c pg_stat_statements.track=all
restart: unless-stopped
deploy:
resources:
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
container_name: fide_postgres
volumes:
- ./.containers_data/postgres:/var/lib/postgresql/data
command: postgres -c shared_preload_libraries=pg_stat_statements -c pg_stat_statements.track=all
environment:
POSTGRES_DB: fide
POSTGRES_USER: admin
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- Add desc indexes for players
CREATE INDEX players_name_desc_idx ON players(name DESC NULLS LAST);
CREATE INDEX players_standard_desc_idx ON players(standard DESC NULLS LAST);
CREATE INDEX players_rapid_desc_idx ON players(rapid DESC NULLS LAST);
CREATE INDEX players_blitz_desc_idx ON players(blitz DESC NULLS LAST);

-- Add desc indexes for federations_summary
CREATE INDEX fed_sum_avg_rating_desc_idx ON federations_summary(avg_rating DESC NULLS LAST);
CREATE INDEX fed_sum_avg_standard_desc_idx ON federations_summary(avg_standard DESC NULLS LAST);
CREATE INDEX fed_sum_avg_rapid_desc_idx ON federations_summary(avg_rapid DESC NULLS LAST);
CREATE INDEX fed_sum_avg_blitz_desc_idx ON federations_summary(avg_blitz DESC NULLS LAST);
CREATE INDEX fed_sum_avg_top_standard_desc_idx ON federations_summary(avg_top_standard DESC NULLS LAST);
CREATE INDEX fed_sum_avg_top_rapid_desc_idx ON federations_summary(avg_top_rapid DESC NULLS LAST);
CREATE INDEX fed_sum_avg_top_blitz_desc_idx ON federations_summary(avg_top_blitz DESC NULLS LAST);
CREATE INDEX fed_sum_avg_top_standard_rank_desc_idx ON federations_summary(avg_top_standard_rank DESC NULLS LAST);
CREATE INDEX fed_sum_avg_top_rapid_rank_desc_idx ON federations_summary(avg_top_rapid_rank DESC NULLS LAST);
CREATE INDEX fed_sum_avg_top_blitz_rank_desc_idx ON federations_summary(avg_top_blitz_rank DESC NULLS LAST);
CREATE INDEX fed_sum_standard_players_desc_idx ON federations_summary(standard_players DESC NULLS LAST);
CREATE INDEX fed_sum_rapid_players_desc_idx ON federations_summary(rapid_players DESC NULLS LAST);
CREATE INDEX fed_sum_blitz_players_desc_idx ON federations_summary(blitz_players DESC NULLS LAST);
CREATE INDEX fed_sum_players_desc_idx ON federations_summary(players DESC NULLS LAST);