what is the best way to clean xcom table in airflow? thats running in docker with postgres db.
i’ve try to delete some data with query (Delete from xcom) and try running this reference: https://cloud.google.com/composer/docs/cleanup-airflow-database but it doesn’t work, xcom table size still doesn’t decrease
related to this case it takes up a lot of storage on my host server
edited:
version I use: Airflow 1.10.3
2
Answers
after execute that query, then run
VACUUM FULL;
from the hostWith every question, please provide details (versions, stack traces, etc.) about what you tried, and what didn’t work. Saying "it doesn’t work" doesn’t tell anything and makes it difficult to help. See https://stackoverflow.com/help/how-to-ask for how to write a good question.
If you have direct access to the metastore, you could execute this query:
The XCom table contains a timestamp which you can use to preserve recent XComs. For example, this query deletes all XComs older than 14 days:
If you do not have direct access to the metastore, you could create a DAG to clean up objects in the metastore. Whether you run this on a schedule to clean objects periodically, or without a schedule and run it whenever you want to clean up the database is up to yourself:
The XCom object has several attributes which you could filter on, for example
dag_id
: