diff --git a/docs/src/main/sphinx/connector/delta-lake.rst b/docs/src/main/sphinx/connector/delta-lake.rst index b0866725e4f6..7cb95ceb55fc 100644 --- a/docs/src/main/sphinx/connector/delta-lake.rst +++ b/docs/src/main/sphinx/connector/delta-lake.rst @@ -293,11 +293,52 @@ statements, the connector supports the following features: * :doc:`/sql/create-schema`, see also :ref:`delta-lake-create-schema` * :doc:`/sql/create-table`, see also :ref:`delta-lake-create-table` * :doc:`/sql/create-table-as` -* :doc:`/sql/drop-schema` * :doc:`/sql/drop-table` +* :doc:`/sql/alter-table` +* :doc:`/sql/drop-schema` * :doc:`/sql/show-create-schema` * :doc:`/sql/show-create-table` +.. _delta-lake-alter-table-execute: + +ALTER TABLE EXECUTE +^^^^^^^^^^^^^^^^^^^ + +The connector supports the following commands for use with +:ref:`ALTER TABLE EXECUTE `. + +optimize +"""""""" + +The ``optimize`` command is used for rewriting the content +of the specified table so that it is merged into fewer but larger files. +In case that the table is partitioned, the data compaction +acts separately on each partition selected for optimization. +This operation improves read performance. + +All files with a size below the optional ``file_size_threshold`` +parameter (default value for the threshold is ``100MB``) are +merged: + +.. code-block:: sql + + ALTER TABLE test_table EXECUTE optimize + +The following statement merges files in a table that are +under 10 megabytes in size: + +.. code-block:: sql + + ALTER TABLE test_table EXECUTE optimize(file_size_threshold => '10MB') + +You can use a ``WHERE`` clause with the columns used to partition the table, +to filter which partitions are optimized: + +.. code-block:: sql + + ALTER TABLE test_partitioned_table EXECUTE optimize + WHERE partition_key = 1 + .. _delta-lake-special-columns: Special columns