-
Notifications
You must be signed in to change notification settings - Fork 104
Add support for materialized views #2482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ullingerc
wants to merge
111
commits into
ad-freiburg:master
Choose a base branch
from
ullingerc:materializedviews-experiment
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add support for materialized views #2482
ullingerc
wants to merge
111
commits into
ad-freiburg:master
from
ullingerc:materializedviews-experiment
Conversation
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
hannahbast
pushed a commit
that referenced
this pull request
Nov 24, 2025
#2519) Previously, the `IndexScan` constructor took a `Permutation::Enum` and retrieved the respective `Permutation` and `LocatedTriplesSnapshot` from its `QueryExecutionContext`. However, this was limited to the six standard permutations PSO, POS, SPO, SOP, OSP, and OPS. With this change, the `IndexScan` constructor takes a `PermutationPtr` and `LocatedTriplesSnapshotPtr`, which are shared pointers to the "real thing". This can then be used also for custom permutations, which are not part of the regular index, in particular those from the materialized views in #2482 NOTE: The "normal" and "internal" variant of the PSO or POS permutation still use the same `PermutationPtr`. The distinction is made via `std::unique_ptr<Permutation> internalPermutation_` in the `Permutation` class, which is rather hacky. Instead, the distinction should be made in the query planner, so that the `PermutationPtr` object is already the correct permutation (normal or internal). That is work for a separate PR.
hannahbast
pushed a commit
that referenced
this pull request
Dec 5, 2025
Refactor the (rather lengthy and complex) `CompressedRelationWriter::createPermutationPair` method into an own `struct`, where complex lambdas become proper member functions and the core loop that iterates over all blocks of triples is now much easier to read and much shorter. This is the foundation of further refactoring, in particular for the writing of only a single permutation as opposed to a pair of permutations. Preparation for #2537 and thus also #2482
Overview
Conformance check passed ✅No test result changes. |
|
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.



Included in this PR
MaterializedView,MaterializedViewWriter,MaterializedViewsManagerIndexScansupport forMaterializedViewNote: this PR is merged with and depends on helper PR #2519
Shortcomings to be adressed in future PRs
MaterializedViewWritercurrently computes and immediately discards an unused SOP permutationIndexScan) - they are discarded automatically via column strippingUsage examples (Reading + Writing, Libqlever + HTTP)
Write a materialized view with libqlever:
Write a materialized view with an HTTP request:
Load a view explicitly with libqlever:
qlv.loadMaterializedView("nameOfTheView");Load a view explicitly with an HTTP request (otherwise it is loaded automatically when the first query is issued on the view):
curl "http://localhost:7930/?cmd=load-materialized-view&view-name=nameOfTheView&access-token=$ACCESS_TOKEN"Different ways to read from a materialized view:
Performance tests for geometries and geometry info
All experiments with warm OS disk cache (Run query once, clear cache, run query again and take the time of the run after clear-cache). Indices have
on-disk-compressed-geo-splitvocabulary type. The materialized view containsgeo:hasGeometry/geo:asWKT,geof:centroid,geof:metricLength,geof:metricArea.Query to write the view:
Times below indicated as: Time-without-using-view -> Time-using-view
OSM Switzerland
View stats: 58,870,803 rows, time for writing 32 sec, size 941 MiB
geo:hasGeometry/geo:asWKTwith?osm_id osmkey:highway []: 600 ms -> 270 msgeo:hasGeometry/geo:asWKTwith?osm_id osmkey:building []: 775 ms -> 290 msgeo:hasGeometry/geo:asWKTwith?osm_id osmkey:amenity "restaurant": 250 ms -> 150 msosmrel:1690227 geo:hasGeometry/geo:asWKT(Zurich): 4 ms -> 2 msgeo:hasGeometry/geo:asWKT,geof:centroid, andgeof:metricAreaof allosmkey:building []: 3780 ms -> 350 ms (Note that the index hason-disk-compressed-geo-splitvocabulary type - the results are thus precomputed in both cases, just the method of retrieval is different)?osm_id osmkey:name "Zürich" . ?osm_id geo:hasGeometry/geo:asWKT ?geometry, both 13 ms, prefiltered Index Scan reads 8 of 1256 blocks of viewOSM Planet
View stats: 11,358,592,564 rows, time for writing 12 min 52 sec, size 183 GiB
geo:hasGeometry/geo:asWKTwith?osm_id osmkey:highway []withLIMIT 1000: 26912ms -> 1768ms?osm_id osmkey:name "Zürich" . ?osm_id geo:hasGeometry/geo:asWKT ?geometry, 271ms -> 66msPerformance tests for large star (table-like structure)
Like above, experiments run with warm cache. Queries run with
?send=0to avoid measuring export time.DBLP
Wrote view with:
View stats: 3,039,856 rows, time for writing < 1 sec, size 17 MiB
Query without view: time to compute 397ms, total time 444ms
Query with view: time to compute 3ms, total time 75ms