From be6c736148e607985ce2e5bb7a27c57a1747aa91 Mon Sep 17 00:00:00 2001 From: gluap Date: Sun, 16 Jul 2023 13:44:11 +0200 Subject: [PATCH] Add index to fix very slow rendering speed on low zoom levels. --- ...7868aed76122_add_overtaking_event_index.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 api/migrations/versions/7868aed76122_add_overtaking_event_index.py diff --git a/api/migrations/versions/7868aed76122_add_overtaking_event_index.py b/api/migrations/versions/7868aed76122_add_overtaking_event_index.py new file mode 100644 index 0000000..1921239 --- /dev/null +++ b/api/migrations/versions/7868aed76122_add_overtaking_event_index.py @@ -0,0 +1,26 @@ +"""add_overtaking_event_index + + +Revision ID: 7868aed76122 +Revises: 587e69ecb466 +Create Date: 2023-07-16 13:37:17.694079 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '7868aed76122' +down_revision = '587e69ecb466' +branch_labels = None +depends_on = None + + +def upgrade(): + op.execute("CREATE INDEX IF NOT EXISTS ix_overtaking_event_geometry ON overtaking_event using GIST(geometry);") + + +def downgrade(): + op.drop_index("ix_overtaking_event_geometry") +