<p>I am running airflow using postgres.</p>
<p>There was a phenomenon that the web server was slow during operation.</p>
<p>It was a problem caused by data continuing to accumulate in dag_run and log of the db table (it became faster by accessing postgres and deleting data directly).</p>
<p>Are there any airflow options to clean the db periodically?</p>
<p>If there is no such option, we will try to delete the data directly using the dag script.</p>
<p>And I think it's strange that the web server slows down because there is a lot of data. Does the web server get all the data when opening another window?</p>

<p>You can purge old records by running:</p>
<pre class="lang-bash prettyprint-override"><code>airflow db clean [-h] --clean-before-timestamp CLEAN_BEFORE_TIMESTAMP [--dry-run] [--skip-archive] [-t TABLES] [-v] [-y]
</code></pre>
<p>(<a href="https://airflow.apache.org/docs/apache-airflow/stable/cli-and-env-variables-ref.html#clean" rel="nofollow noreferrer">cli reference</a>)</p>
<p>It is a quite common setup to include this command in a DAG that runs periodically.</p>
