<@U04S8PLJWMT> is it possible to reduce postgres d...
# ask-ai
f
@kapa.ai is it possible to reduce postgres disk space deleting some data?
k
Yes, it is possible to reduce Postgres disk space by deleting some data, but the approach depends on what data you want to remove: 1. Airbyte Internal Databases (e.g., jobs, attempts, temporal): - You can reduce disk usage by purging old sync/job history. For the Temporal database (which can grow large), you can set the
TEMPORAL_HISTORY_RETENTION_IN_DAYS
environment variable to a lower value to automatically clean up old workflow history. However, for tables like
jobs
and
attempts
in the Airbyte database, there is currently no built-in cleanup routine, so manual deletion may be required, but this is not officially documented and should be done with caution to avoid breaking Airbyte functionality. More details can be found in the discussion [here](https://github.com/airbytehq/airbyte/discussions/55233). 2. Destination Postgres Database: - If your destination Postgres database is filling up due to Airbyte syncs, you can manually delete data from tables or drop unnecessary tables. Be aware that Airbyte may recreate tables (and dependent objects) during syncs, especially if you use the "Drop tables with CASCADE" option, which can also remove dependent objects like views. If you do this, ensure you have a way to recreate any necessary objects, such as using dbt for automation [see documentation](https://docs.airbyte.com/integrations/destinations/postgres#creating-dependent-objects). 3. Temporary and Internal Tables: - Airbyte creates temporary tables (e.g.,
_airbyte_tmp_*
) during syncs. Normally, these are cleaned up after successful syncs, but failed syncs may leave them behind. You can manually drop these tables to reclaim space. This is discussed in [this forum post](https://discuss.airbyte.io/t/2067). 4. Replication Slot WAL Files (for CDC): - If you use Change Data Capture (CDC) with Postgres, logical replication slots can cause disk usage to grow if WAL files are not consumed and acknowledged. To avoid this, ensure frequent syncs or manually delete unused replication slots if you stop syncing. For low-transaction databases, you may need to add a heartbeat table or increase transaction activity to advance the replication slot and allow WAL cleanup [see documentation](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#advanced-wal-disk-consumption-and-heartbeat-action-query). Caution: Always back up your data before deleting anything, and be aware that manual deletions may impact Airbyte's ability to track sync state or recover from failures. If you need to clean up Airbyte's own metadata and logs, adjusting retention settings is the safest supported method. For destination data, deletion is possible but should be managed carefully to avoid breaking downstream processes.
f
@kapa.ai I mean internal postgres for airbyte status
k
A message from kapa.ai
Yes, it is possible to reduce disk space in Airbyte’s internal Postgres database by deleting some data, but there are important caveats: - For the Temporal database (which often grows large), you can set the environment variable
TEMPORAL_HISTORY_RETENTION_IN_DAYS
to a lower value. This will automatically clean up old workflow history and reduce disk usage in the Temporal DB. This is a supported and recommended approach for managing the size of the Temporal database [Purging of old syncs from Airbyte databases](https://github.com/airbytehq/airbyte/discussions/55233). - For the main Airbyte database (which contains tables like
jobs
and
attempts
), there is currently no built-in cleanup routine for old job and attempt records. Manual deletion of records from these tables is technically possible, but it is not officially documented or supported, and may have side effects on Airbyte’s ability to track sync state and job history. Proceed with caution if you choose to do this, and always back up your database first [Purging of old syncs from Airbyte databases](https://github.com/airbytehq/airbyte/discussions/55233). In summary: - You can safely reduce Temporal DB size using the retention variable. - For the main Airbyte DB, manual deletion is possible but not officially supported or documented, and should be done carefully. If you need more detailed, step-by-step guidance for manual cleanup, the knowledge sources do not provide it.
f
@kapa.ai how can I check how much is the disk space of Temporal database , jobs and attempts?
k
A message from kapa.ai
To check how much disk space is used by the Temporal database, as well as the Airbyte internal tables like
jobs
and
attempts
, you can use SQL queries against your Postgres databases. The knowledge sources provide an example of how to list the top tables by size in your databases. Here’s a sample query you can run in your Postgres shell:
Copy code
sql SELECT   relname AS "Table",   pg_size_pretty(pg_total_relation_size(relid)) AS "Total Size" FROM   pg_catalog.pg_statio_user_tables ORDER BY   pg_total_relation_size(relid) DESC LIMIT 10;
This will show you the largest tables (including
jobs
,
attempts
, and Temporal tables like
history_node
) and their disk usage. You can run this query on each relevant database (e.g., your Airbyte internal database and your Temporal database) to see which tables are consuming the most space. This approach is demonstrated in the discussion where users list the top tables by size in both the Airbyte and Temporal databases [Purging of old syncs from Airbyte databases](https://github.com/airbytehq/airbyte/discussions/55233).
f
@kapa.ai attempts DB is 37GB how can I reduce it?
k
A message from kapa.ai
Currently, there is no officially documented or supported method in Airbyte to automatically clean up or reduce the size of the
attempts
table
in the internal Airbyte Postgres database. The knowledge sources confirm that while you can configure retention for the Temporal database using the
TEMPORAL_HISTORY_RETENTION_IN_DAYS
variable, there is no built-in cleanup routine for the
attempts
or
jobs
tables. Manual deletion is technically possible, but it is not documented or recommended by Airbyte, and could have side effects on platform functionality [Purging of old syncs from Airbyte databases](https://github.com/airbytehq/airbyte/discussions/55233). Summary: - There is no supported or documented way to safely reduce the size of the
attempts
table. - Manual deletion is not recommended and may break Airbyte’s job tracking. If this is a critical issue, you may want to follow or comment on the related discussion to express your need for this feature.