ANALYZE statement not working on Delta Live Tables (DLT)

Allow the built-in maintenance job to run instead of using ANALYZE.

Written by Jose Gonzalez

Last published at: January 22nd, 2025

Problem

When you use the Delta Live Tables (DLT) service to load data into streaming tables, in order to execute ANALYZE statements on Unity Catalog tables, you receive an error.

 

"PERMISSION_DENIED: MV/ST internal properties can only be updated through DLT. SQLSTATE: 42501".

 

Cause

ANALYZE statements are not supported for streaming tables. 

 

Solution

With Delta Live Tables, running ANALYZE TABLE is not necessary. A DLT pipeline has a process that runs every 24 hours, called the maintenance job. This job performs optimization and vacuum on Delta tables that are part of the DLT pipeline.