lowka commented on code in PR #4434: URL: https://github.com/apache/ignite-3/pull/4434#discussion_r1776801784
########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImpl.java: ########## @@ -101,10 +109,12 @@ public SqlSchemaManagerImpl(CatalogManager catalogManager, CacheFactory factory, /** {@inheritDoc} */ @Override public SchemaPlus schema(int catalogVersion) { - return schemaCache.get( + SchemaPlus schemaPlus = schemaCache.get( catalogVersion, version -> createRootSchema(catalogManager.catalog(version)) ); + + return makeSchemaCopyWithStatisticSnapshot(schemaPlus, catalogVersion); Review Comment: I think this is not a good idea to re-create calcite's schema for each call. Could you please run some benchmarks to show that these change does not affect performance? Because with this change every caller is going to pay the price for statistics even when they do not need it (see fast plans) You can move this code to `PrepareServiceImpl` `prepareXXX` methods because statistics is not needed unless the SQL engine decides to run full optimisation. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org