Skip to content

Commit 6606f1e

Browse files
hf-kkleinKonstantinCopilot
authored
perf: add additional covering index to ahb_expressions (#227)
* perf: add additional covering index to `ahb_expressions` * Update src/fundamend/sqlmodels/expression_view.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * the first arg to Index is the index name, not the first column involved --------- Co-authored-by: Konstantin <konstantin.klein+github@hochfrequenz.de> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent b3342a6 commit 6606f1e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/fundamend/sqlmodels/expression_view.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from typing import Optional
1010

1111
from efoli import EdifactFormat, EdifactFormatVersion
12+
from sqlalchemy import Index
1213

1314
from fundamend.sqlmodels import AhbHierarchyMaterialized, Bedingung
1415
from fundamend.sqlmodels.anwendungshandbuch import Paket, UbBedingung
@@ -229,6 +230,15 @@ class AhbExpression(SQLModel, table=True):
229230
"expression",
230231
name="idx_ahb_expressions_metadata_expression",
231232
),
233+
Index(
234+
# this is to speed up the v_ahb_diff joins
235+
"idx_ahb_expressions_covering_v_ahb_diff",
236+
"edifact_format_version",
237+
"format",
238+
"expression",
239+
"node_texts",
240+
"ahbicht_error_message",
241+
),
232242
)
233243
id: uuid.UUID = Field(primary_key=True, default_factory=uuid.uuid4)
234244
edifact_format_version: EdifactFormatVersion = Field(index=True)

0 commit comments

Comments
 (0)