Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion docs/materialized-views.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,29 @@ You can optionally preload materialized views. This is required for implicitly r
qlv.loadMaterializedView("nameOfTheView");
```

## Deleting a materialized view

A materialized view that is no longer needed can be deleted. This unloads the
view (if it is currently loaded) and permanently removes all of its files from
disk. Deleting a view that does not exist results in an error.

=== "qlever CLI"
```bash
qlever materialized-view $VIEW_NAME --delete
```
=== "curl"
``` bash
curl "http://$HOST:$PORT/?cmd=delete-materialized-view&view-name=$VIEW_NAME&access-token=$ACCESS_TOKEN"
# Returns: {"materialized-view-deleted":"nameOfTheView"}
```
=== "libqlever"
```cpp
qlever::EngineConfig config;
config.baseName_ = "my-dataset";
qlever::Qlever qlv{config};
qlv.deleteMaterializedView("nameOfTheView");
```

## Querying a materialized view

Materialized views can be queried using the special predicate
Expand Down Expand Up @@ -303,6 +326,6 @@ releases of QLever.
3. Materialized views are currently read-only; that is, update operation do
not modify materialized views. If you need to update a materialized view,
you must currently recreate it from scratch (you can simply overwrite an
existing view).
existing view, or [delete](#deleting-a-materialized-view) it first).
4. Reading from a materialized view always reads the first three columns even
if they are not requested; the unused ones are discarded immediately.