-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(eap-spans): Add an index on project_id
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
snuba/snuba_migrations/events_analytics_platform/0019_add_project_id_index_back.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from typing import Sequence | ||
|
||
from snuba.clusters.storage_sets import StorageSetKey | ||
from snuba.migrations import migration, operations | ||
from snuba.migrations.operations import SqlOperation | ||
|
||
storage_set_name = StorageSetKey.EVENTS_ANALYTICS_PLATFORM | ||
local_table_name = "eap_spans_2_local" | ||
|
||
|
||
class Migration(migration.ClickhouseNodeMigration): | ||
blocking = False | ||
|
||
def forwards_ops(self) -> Sequence[SqlOperation]: | ||
return [ | ||
operations.AddIndex( | ||
storage_set=StorageSetKey.EVENTS_ANALYTICS_PLATFORM, | ||
table_name=local_table_name, | ||
index_name="bf_project_id", | ||
index_expression="project_id", | ||
index_type="bloom_filter", | ||
granularity=1, | ||
target=operations.OperationTarget.LOCAL, | ||
), | ||
] | ||
|
||
def backwards_ops(self) -> Sequence[SqlOperation]: | ||
return [ | ||
operations.DropIndex( | ||
storage_set=StorageSetKey.EVENTS_ANALYTICS_PLATFORM, | ||
table_name=local_table_name, | ||
index_name="bf_project_id", | ||
target=operations.OperationTarget.LOCAL, | ||
), | ||
] |