# Binary file exchange

Binary formats can preserve typed values and container metadata without rendering every value as display text. Use the native client's `--query` and stdout redirection for exports, then supply the resulting bytes as input.

## Choose a representation

| Format family                     | Layout                                               |
| --------------------------------- | ---------------------------------------------------- |
| `row_binary`                      | Positional fields using declared types.              |
| `row_binary_with_names_and_types` | Field bytes plus column names and type declarations. |
| Arrow IPC                         | A file or stream with a schema and record batches.   |
| Parquet                           | A columnar file with row groups and metadata.        |
| Avro                              | An object container with a record schema.            |
| `msg_pack`                        | Consecutive positional fields.                       |

A stored schema does not remove CoordinatorDB's requirement for an explicit destination table or the ordinary file() schema argument.

## Export and import

1. Query the required columns in a defined order.
2. Select an output-capable binary format and redirect exact bytes to a file.
3. Create the destination with compatible declarations.
4. Load the file through FROM INFILE or attached INSERT FORMAT input.
5. Query the destination to verify values and row counts.

Use the executable examples on the individual [format pages](https://coordinatordb.com/docs/reference/formats). CoordinatorDB aggregate-state bytes are not a portable ClickHouse format; finalize them when an interchange representation is required.
