Back to Questdb

DROP MATERIALIZED VIEW

documentation/query/sql/drop-mat-view.md

latest1.8 KB
Original Source

Permanently deletes a materialized view and all its data.

Syntax

DROP MATERIALIZED VIEW [ IF EXISTS ] viewName

Parameters

ParameterDescription
viewNameName of the materialized view to drop
IF EXISTSSuppress error if view doesn't exist

Examples

questdb-sql
DROP MATERIALIZED VIEW trades_hourly;
questdb-sql
DROP MATERIALIZED VIEW IF EXISTS trades_hourly;

Behavior

AspectDescription
PermanenceDeletion is permanent and not recoverable
Space reclamationDisk space is reclaimed asynchronously
Active queriesExisting read queries may delay space reclamation
Non-standard volumesView is logically removed; data remains in the volume

:::warning This operation cannot be undone. The view and all its pre-computed data will be permanently deleted. :::

Permissions (Enterprise)

Dropping a materialized view requires the DROP MATERIALIZED VIEW permission on the specific view:

questdb-sql
GRANT DROP MATERIALIZED VIEW ON trades_hourly TO user1;

The view creator automatically receives this permission with the GRANT option.

Errors

ErrorCause
materialized view does not existView doesn't exist and IF EXISTS not specified
permission deniedMissing DROP MATERIALIZED VIEW permission (Enterprise)

See also