# Partitioned Tables support

> Source: https://docs.synthesized.io/tdk/latest/user_guide/080_troubleshooting/database_specific/postgres_partitioned_table
> For the complete documentation index, see [llms.txt](https://docs.synthesized.io/llms.txt).

TDK supports PostgreSQL partitioned tables. However, there are some limitations and recommendations to consider when working with partitioned tables.

## Limitations

1. **Schema Copying**
  
  - Schema Copying does not fully support partitioned tables.
  - If the property `schema_creation_mode` is set to `CREATE`, `DROP_AND_CREATE`, or `CREATE_IF_NOT_EXISTS`, the schema copy process will ignore the fact that some tables are partitioned.
  - This may not cause an immediate error, but it is **recommended** to set `schema_creation_mode` to `DO_NOT_CREATE` to avoid issues. Ensure the same DDL operations are executed on both the source (input) and target (output) databases manually.
2. **Subsetting Mode (combination of `mode: MASKING` or `KEEP` and `target_ratio` < 1)** The working directory must be configured correctly when using subsetting mode. Otherwise, the execution will produce an error.

> **CAUTION**
> If the working directory is not configured correctly, subsetting mode will still execute without warnings. However, the output database will contain regular tables instead of partitioned tables, which might lead to unexpected results.

## Recommendations

- Use the `DO_NOT_CREATE` schema creation mode for partitioned tables to ensure schema consistency. Execute DDL operations manually on the target database.
- Double-check the configuration of the working directory when using subsetting mode to avoid unexpected behavior.

## Preserved Partition Attributes

When copying a partitioned table, Synthesized preserves the following on the target database:

- Partition bounds
- Primary keys
- Unique keys
- Foreign keys

No additional configuration is required for this preservation.

For known issues and workarounds with partitioned tables, see [Troubleshooting partitioned tables](https://docs.synthesized.io/tdk/latest/user_guide/080_troubleshooting/database_specific/postgres_partitioned_table).
