Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ Write the date in place of the "Unreleased" in the case a new version is release
### Added

- The project ships with a pixi manifest (`pixi.toml`).
<<<<<<< HEAD
- Covering index on the `nodes` table (only relevant for PostgreSQL catalogs).

=======
- Connection pool settings for catalog and storage databases.
>>>>>>> main

## v0.1.0-b34 (2025-08-14)

Expand Down
1 change: 1 addition & 0 deletions tiled/catalog/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# This is list of all valid revisions (from current to oldest).
ALL_REVISIONS = [
"9b4bbdcdaf80",
"dfbb7478c6bd",
"a963a6c32a0c",
"e05e918092c3",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""create-covering-index

Revision ID: 9b4bbdcdaf80
Revises: dfbb7478c6bd
Create Date: 2025-08-20 08:54:39.273733

"""
import logging

from alembic import op

# revision identifiers, used by Alembic.
revision = "9b4bbdcdaf80"
down_revision = "dfbb7478c6bd"
branch_labels = None
depends_on = None


logger = logging.getLogger(__name__)
logger.setLevel("INFO")
handler = logging.StreamHandler()
handler.setLevel("DEBUG")
handler.setFormatter(logging.Formatter("%(message)s"))
logger.addHandler(handler)


def upgrade():
connection = op.get_bind()

if connection.engine.dialect.name == "postgresql":
op.create_index(
"ix_nodes_parent_time_id_key",
"nodes",
["parent", "time_created", "id"],
postgresql_include=["key"],
)
logger.info("Created covering index on nodes table.")


def downgrade():
connection = op.get_bind()

if connection.engine.dialect.name == "postgresql":
op.drop_index(
"ix_nodes_parent_time_id_key",
table_name="nodes",
)
logger.info("Dropped covering index on nodes table.")
14 changes: 12 additions & 2 deletions tiled/catalog/orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ def unique_parameter_num_null_check(target, connection, **kw):

@event.listens_for(Node.__table__, "after_create")
def create_index_metadata_tsvector_search(target, connection, **kw):
# This creates a ts_vector based metadata search index for fulltext.
# Postgres only feature
# Postgres only features
if connection.engine.dialect.name == "postgresql":
# This creates a ts_vector based metadata search index for fulltext
connection.execute(
text(
"""
Expand All @@ -303,6 +303,16 @@ def create_index_metadata_tsvector_search(target, connection, **kw):
"""
)
)
# Covering B-tree index on (parent, time_created, id) INCLUDE (key)
connection.execute(
text(
"""
CREATE INDEX ix_nodes_parent_time_id_key
ON nodes (parent, time_created, id)
INCLUDE (key)
"""
)
)


@event.listens_for(NodesClosure.__table__, "after_create")
Expand Down
Loading