From 761aad6d9de347c57ced511255500fae121b85dd Mon Sep 17 00:00:00 2001 From: "David H. Irving" Date: Wed, 20 Nov 2024 16:31:54 -0700 Subject: [PATCH] DO NOT MERGE: disable caching of collection summaries With the cache enabled, every query on the server is pulling and processing 17k rows of dataset summaries because filtering is disabled when the cache is on. (Which is all queries). This is more like 1 or 60 rows if we use the filter. The processing of these rows seems to be taking excessive synchronous CPU time (300ms+ on the server). --- .../butler/registry/datasets/byDimensions/summaries.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/lsst/daf/butler/registry/datasets/byDimensions/summaries.py b/python/lsst/daf/butler/registry/datasets/byDimensions/summaries.py index d57636899e..382ba812f9 100644 --- a/python/lsst/daf/butler/registry/datasets/byDimensions/summaries.py +++ b/python/lsst/daf/butler/registry/datasets/byDimensions/summaries.py @@ -364,9 +364,9 @@ def fetch_summaries( sql = sqlalchemy.sql.select(*columns).select_from(fromClause) sql = sql.where(coll_col.in_([coll.key for coll in non_chains])) # For caching we need to fetch complete summaries. - if self._caching_context.collection_summaries is None: - if dataset_type_names is not None: - sql = sql.where(self._dataset_type_table.columns["name"].in_(dataset_type_names)) + # if self._caching_context.collection_summaries is None: + if dataset_type_names is not None: + sql = sql.where(self._dataset_type_table.columns["name"].in_(dataset_type_names)) # Run the query and construct CollectionSummary objects from the result # rows. This will never include CHAINED collections or collections @@ -407,8 +407,8 @@ def fetch_summaries( for chain, children in chains.items(): summaries[chain.key] = CollectionSummary.union(*(summaries[child.key] for child in children)) - if self._caching_context.collection_summaries is not None: - self._caching_context.collection_summaries.update(summaries) + # if self._caching_context.collection_summaries is not None: + # self._caching_context.collection_summaries.update(summaries) return summaries