Skip to content

Commit

Permalink
FEAT: Add _projectname to terms_index table
Browse files Browse the repository at this point in the history
We filter the terms table by the _projectname column, but not currently
the terms_index table. If we add the _projectname column to the index we
won't need to reference the main table and can perform some SQL pushdown
to narrow the join space when joining across multiple entities using the
index.

Add the _projectname column to the the sbeacon_terms_index table.
  • Loading branch information
bhosking committed Dec 16, 2024
1 parent b58f0c7 commit 1939bf4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions athena.tf
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,10 @@ resource "aws_cloudformation_stack" "sbeacon_terms_index_stack" {
{
Name = "term"
Type = "string"
},
{
Name = "_projectname"
Type = "string"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion lambda/indexer/generate_query_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
bucket_count = 50
)
AS
SELECT id, term, kind FROM "{table}";
SELECT id, term, _projectname, kind FROM "{table}";
"""
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
ENV_ATHENA.ATHENA_RUNS_TABLE,
ENV_ATHENA.ATHENA_ANALYSES_TABLE,
ENV_ATHENA.ATHENA_TERMS_TABLE,
ENV_ATHENA.ATHENA_TERMS_INDEX_TABLE,
}


Expand Down

0 comments on commit 1939bf4

Please sign in to comment.