Skip to content

Commit

Permalink
minor: Added indexes to sql tables to optimize query execution
Browse files Browse the repository at this point in the history
Signed-off-by: Bhargav Dodla <[email protected]>
  • Loading branch information
Bhargav Dodla committed Sep 19, 2024
1 parent 0fb76e9 commit 2c48b00
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions sdk/python/feast/infra/registry/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from sqlalchemy import ( # type: ignore
BigInteger,
Column,
Index,
LargeBinary,
MetaData,
String,
Expand Down Expand Up @@ -82,6 +83,8 @@
Column("project_proto", LargeBinary, nullable=False),
)

Index("idx_projects_project_id", projects.c.project_id)

entities = Table(
"entities",
metadata,
Expand All @@ -91,6 +94,8 @@
Column("entity_proto", LargeBinary, nullable=False),
)

Index("idx_entities_project_id", entities.c.project_id)

data_sources = Table(
"data_sources",
metadata,
Expand All @@ -100,6 +105,8 @@
Column("data_source_proto", LargeBinary, nullable=False),
)

Index("idx_data_sources_project_id", data_sources.c.project_id)

feature_views = Table(
"feature_views",
metadata,
Expand All @@ -111,6 +118,8 @@
Column("user_metadata", LargeBinary, nullable=True),
)

Index("idx_feature_views_project_id", feature_views.c.project_id)

stream_feature_views = Table(
"stream_feature_views",
metadata,
Expand All @@ -121,6 +130,8 @@
Column("user_metadata", LargeBinary, nullable=True),
)

Index("idx_stream_feature_views_project_id", stream_feature_views.c.project_id)

on_demand_feature_views = Table(
"on_demand_feature_views",
metadata,
Expand All @@ -131,6 +142,8 @@
Column("user_metadata", LargeBinary, nullable=True),
)

Index("idx_on_demand_feature_views_project_id", on_demand_feature_views.c.project_id)

feature_services = Table(
"feature_services",
metadata,
Expand All @@ -140,6 +153,8 @@
Column("feature_service_proto", LargeBinary, nullable=False),
)

Index("idx_feature_services_project_id", feature_services.c.project_id)

saved_datasets = Table(
"saved_datasets",
metadata,
Expand All @@ -149,6 +164,8 @@
Column("saved_dataset_proto", LargeBinary, nullable=False),
)

Index("idx_saved_datasets_project_id", saved_datasets.c.project_id)

validation_references = Table(
"validation_references",
metadata,
Expand All @@ -157,6 +174,7 @@
Column("last_updated_timestamp", BigInteger, nullable=False),
Column("validation_reference_proto", LargeBinary, nullable=False),
)
Index("idx_validation_references_project_id", validation_references.c.project_id)

managed_infra = Table(
"managed_infra",
Expand All @@ -167,6 +185,8 @@
Column("infra_proto", LargeBinary, nullable=False),
)

Index("idx_managed_infra_project_id", managed_infra.c.project_id)

permissions = Table(
"permissions",
metadata,
Expand All @@ -176,6 +196,8 @@
Column("permission_proto", LargeBinary, nullable=False),
)

Index("idx_permissions_project_id", permissions.c.project_id)


class FeastMetadataKeys(Enum):
LAST_UPDATED_TIMESTAMP = "last_updated_timestamp"
Expand All @@ -191,6 +213,8 @@ class FeastMetadataKeys(Enum):
Column("last_updated_timestamp", BigInteger, nullable=False),
)

Index("idx_feast_metadata_project_id", feast_metadata.c.project_id)

logger = logging.getLogger(__name__)


Expand Down

0 comments on commit 2c48b00

Please sign in to comment.