analyzeTable
analyzeTable
is a Change Type in the Liquibase Open Source Databricks extension that analyzes a table.
Uses
You can use analyzeTable
to collect statistics about your table. This helps the Databricks query optimizer develop an optimal query plan. That way, it can improve query performance and speed up the operations you make on your tables.
Run analyzeTable
To run this Change Type, follow these steps:
- Add the Change Type to your changeset, as shown in the examples on this page.
- Specify any required attributes. Use the table on this page to see which ones your database requires.
- Deploy your changeset by running the
update
command:
liquibase update
Available attributes
Tip: You must specify all top-level attributes marked as required. If you specify an optional attribute, you must also specify any nested attributes that it requires.
Name | Type | Description | Requirement |
---|---|---|---|
tableName
|
String | Name of the table to analyze. | Required |
analyzeColumns
|
String | Name of the column(s) to analyze. Separate multiple values using commas. | Optional |
Note: The PARTITION
SQL clause is not supported for the analyzeTable
Change Type.
Examples
Note: Rollback is not supported for analyzeTable
.
databaseChangeLog:
- changeSet:
id: 2
author: your.name
changes:
- analyzeTable:
tableName: test_analyze_table
analyzeColumns: col_1,col_2
{
"databaseChangeLog": [
{
"changeSet": {
"id": "2",
"author": "your.name",
"changes": [
{
"analyzeTable": {
"tableName": "test_analyze_table",
"analyzeColumns": "col_1,col_2"
}
}
]
}
}
]
}
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:databricks="http://www.liquibase.org/xml/ns/databricks"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/databricks
http://www.liquibase.org/xml/ns/databricks/liquibase-databricks-latest.xsd
http://www.liquibase.org/xml/ns/pro
http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">
<changeSet id="2" author="your.name">
<databricks:analyzeTable tableName="test_analyze_table" analyzeColumns="col_1,col_2"/>
</changeSet>
</databaseChangeLog>
Database support
This Change Type is only supported for Databricks. It does not support auto rollback.