> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# DROP MATERIALIZED VIEW

> DROP MATERIALIZED VIEW drops a materialized view.

DROP MATERIALIZED VIEW drops a materialized view.

You cannot drop a synchronous materialized view that is being created in process with this command unless you use the **FORCE** option. With **FORCE**, the database cancels any stuck sync MV build jobs, restores the base table state to NORMAL, and then drops the materialized view. Without FORCE, see [Synchronous materialized View - Drop an unfinished materialized view](/documents/4.2/using_starrocks/Materialized_view-single_table.md#drop-an-unfinished-synchronous-materialized-view) for further instructions.

**Tip**

This operation requires the DROP privilege on the target materialized view.

## Syntax

```SQL theme={null}
DROP MATERIALIZED VIEW [IF EXISTS] [database.]mv_name [FORCE]
```

Parameters in brackets \[] are optional.

## Parameters

| **Parameter** | **Required** | **Description** |
| - | - | - |
| IF EXISTS | no | If this parameter is specified, the database will not throw an exception when deleting a materialized view that does not exist. If this parameter is not specified, the system will throw an exception when deleting a materialized view that does not exist. |
| mv\_name | yes | The name of the materialized view to delete. |
| FORCE | no | When the base table is not in NORMAL state (e.g., a sync MV build is stuck), FORCE cancels the related alter jobs, sets the table to NORMAL, and then drops the materialized view. Omit FORCE for normal drops. |

## Examples

Example 1: Drop an existing materialized view

1. View all existing materialized views in the database.

```Plain theme={null}
MySQL > SHOW MATERIALIZED VIEWS\G
*************************** 1. row ***************************
            id: 470740
        name: order_mv1
database_name: sr_hub
      text: SELECT `sr_hub`.`orders`.`dt` AS `dt`, `sr_hub`.`orders`.`order_id` AS `order_id`, `sr_hub`.`orders`.`user_id` AS `user_id`, sum(`sr_hub`.`orders`.`cnt`) AS `total_cnt`, sum(`sr_hub`.`orders`.`revenue`) AS `total_revenue`, count(`sr_hub`.`orders`.`state`) AS `state_count` FROM `sr_hub`.`orders` GROUP BY `sr_hub`.`orders`.`dt`, `sr_hub`.`orders`.`order_id`, `sr_hub`.`orders`.`user_id`
        rows: 0
1 rows in set (0.00 sec)
```

2. Drop the materialized view `order_mv1`.

```SQL theme={null}
DROP MATERIALIZED VIEW order_mv1;
```

3. Check if the dropped materialized view exists.

```Plain theme={null}
MySQL > SHOW MATERIALIZED VIEWS;
Empty set (0.01 sec)
```

Example 2: Drop a non-existing materialized view

* If the parameter `IF EXISTS` is specified, the database will not throw an exception when deleting a materialized view that does not exist.

```Plain theme={null}
MySQL > DROP MATERIALIZED VIEW IF EXISTS k1_k2;
Query OK, 0 rows affected (0.00 sec)
```

* If the parameter `IF EXISTS` is not specified, the system will throw an exception when deleting a materialized view that does not exist.

```Plain theme={null}
MySQL > DROP MATERIALIZED VIEW k1_k2;
ERROR 1064 (HY000): Materialized view k1_k2 is not find
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.