Skip to content

Commit

Permalink
Set SQLite constant_rows_max, and use it in join_data_coordinates.
Browse files Browse the repository at this point in the history
With QG generation now relying heavily on join_data_coordinates, we
were hitting this limit sometimes.
  • Loading branch information
TallJimbo committed Mar 7, 2025
1 parent 31a8d53 commit 4afe366
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/lsst/daf/butler/direct_query_driver/_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def __init__(
self._exit_stack: ExitStack | None = None
self._raw_page_size = raw_page_size
self._postprocessing_filter_factor = postprocessing_filter_factor
self._constant_rows_limit = constant_rows_limit
self._constant_rows_limit = min(constant_rows_limit, db.get_constant_rows_max())
self._cursors: set[_Cursor] = set()

def __enter__(self) -> None:
Expand Down
6 changes: 6 additions & 0 deletions python/lsst/daf/butler/registry/databases/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ def constant_rows(
]
return sqlalchemy.sql.union_all(*selects).alias(name)

def get_constant_rows_max(self):
# Docstring inherited.
# This is the default SQLITE_MAX_COMPOUND_SELECT (see
# https://www.sqlite.org/limits.html):
return 500

@property
def has_distinct_on(self) -> bool:
# Docstring inherited.
Expand Down

0 comments on commit 4afe366

Please sign in to comment.