SchemaView performance improvements#1479
Open
rschili wants to merge 18 commits into
Open
Conversation
… selected schemas
…ull ECN::PrimitiveType support
…nd logging on value saturation
rschili
commented
Jun 26, 2026
| // A PRAGMA (or any statement FormatQuery left unwrapped) has no LIMIT/OFFSET parameters. Use the | ||
| // non-logging TryGetParameterIndex so probing for their absence does not emit "No | ||
| // parameter index found" errors - GetParameterIndex would log one per missing parameter. | ||
| const auto idxCount = stmt.TryGetParameterIndex(LIMIT_VAR_COUNT); |
Contributor
Author
There was a problem hiding this comment.
@khanaffan are you okay with this change?
The previous code was logging a warning because pragma going through concurrent query does not have those two parameters.
This change makes it so we don't log those warnings anymore.
Unrelated change, sneaking it in because it's small and insignificant.
…as and SchemaViewWriter
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends ECDb’s ECSQL pragma surface to support incremental SchemaView loading (fragments) for iTwinjs-core, and introduces a cheap schema identity hash (schema_token) intended for cache invalidation and determinism checks.
Changes:
- Add
PRAGMA schema_view_fragment(...)to return a subset of schemas as a SchemaView-format blob for incremental loading. - Add
PRAGMA checksum(schema_token)backed by a new “name+version only” schema identity hash, and alignschema_view’sschemaTokenwith it. - Refactor/extend
SchemaViewWriterto support fragment filtering and safer state reuse; reduce noisy parameter-missing logs in concurrent query limit binding.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| iModelCore/ECDb/Tests/NonPublished/ECSqlPragmasTests.cpp | Updates checksum/token assertions and adds coverage for schema_token and schema_view_fragment behavior. |
| iModelCore/ECDb/ECDb/SchemaViewWriter.h | Adds fragment-related API/state and clarifies non-concurrent instance usage. |
| iModelCore/ECDb/ECDb/SchemaViewWriter.cpp | Implements fragment filtering, request validation, centralized reset, and safer narrowing for serialized fields. |
| iModelCore/ECDb/ECDb/ECSql/ECSqlPragmas.h | Extends checksum docs/options and declares schema_view_fragment + schema-token hashing support. |
| iModelCore/ECDb/ECDb/ECSql/ECSqlPragmas.cpp | Implements checksum(schema_token), shared schema_view row building, and schema_view_fragment argument parsing. |
| iModelCore/ECDb/ECDb/ECDbImpl.cpp | Registers the new schema_view_fragment pragma handler. |
| iModelCore/ECDb/ECDb/ConcurrentQueryManagerImpl.cpp | Uses TryGetParameterIndex to avoid log spam when LIMIT/OFFSET params don’t exist (e.g., PRAGMAs). |
…ct zero as a valid schema ID
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This was referenced Jun 30, 2026
…d resilience in SchemaView handling
…in/imodel-native into rschili/schema-view-fragment
… and adjust related tests
rschili
marked this pull request as ready for review
July 23, 2026 15:57
rschili
requested review from
RohitPtnkr1996,
calebmshafer,
khanaffan and
pmconne
as code owners
July 23, 2026 15:57
rschili
enabled auto-merge (squash)
July 24, 2026 09:43
rschili
disabled auto-merge
July 24, 2026 09:43
…per, and SchemaViewWriter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
itwinjs-core: iTwin/itwinjs-core#9431
New schema view fragment pragma that will be used by iTwinjs-core to load just subsets of an iModels' schema.
Plus a few fixes, please read the linked itwinjs-core PR description and issue for full details.