How to use vaccum analyze<table > and where it should be used for initial or delta load
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 03:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 04:46 AM
Hi @Databricks_Work , Vacuum and Analzye are two separate commands that are used for optimizing the queries but they perform two different operations.
Vacuum is used to clear the stale data files in your delta table. Vacuum should be run after a optimize operation. We recommend to schedule a batch job to run optimize and vacuum. Generally, the preferred schedule is to run the job weekly but can be changed based on the use case.
Analyze command is used to collect stats on the delta table. This helps in query planning like choosing the type of operation. This command is usually run on adhoc basis but can also be put as part of the daily job run.