Copilot commented on code in PR #60307:
URL: https://github.com/apache/airflow/pull/60307#discussion_r2691415811


##########
airflow-core/src/airflow/migrations/versions/0099_3_2_0_add_dag_version_id_indexes_for_db_cleanup.py:
##########
@@ -0,0 +1,75 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Add indexes on dag_version_id columns for db cleanup performance.
+
+When running `airflow db clean -t dag_version`, the cleanup process needs to
+check for foreign key references in task_instance and dag_run tables. Without
+indexes on these columns, this results in full table scans that can take 
several
+minutes per batch on tables with hundreds of thousands of rows.
+
+This migration adds the missing indexes to speed up the cleanup operation.
+
+See: https://github.com/apache/airflow/issues/60145
+
+Revision ID: 62fb1d0a1252
+Revises: 0b112f49112d

Review Comment:
   The docstring comment states "Revises: 0b112f49112d" but the code correctly 
sets down_revision to "e79fc784f145". The docstring should be updated to match 
the actual down_revision value to avoid confusion.
   ```suggestion
   Revises: e79fc784f145
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to