|
| 1 | +--- |
| 2 | +title: Data Ingestion Engine |
| 3 | +slug: data-ingestion |
| 4 | +description: The QuestDB Data Ingestion Engine supports bulk and streaming ingestion. It writes data to a row-based write-ahead log (WAL) and then converts it into a columnar format. In QuestDB Enterprise, the WAL segments ship to object storage for replication. |
| 5 | +--- |
| 6 | + |
| 7 | + |
| 8 | +## Data ingestion & write path |
| 9 | + |
| 10 | +The QuestDB Data Ingestion Engine supports bulk and streaming ingestion. It writes data to a row-based write-ahead log |
| 11 | +(WAL) and then converts it into a columnar format. In QuestDB Enterprise, the WAL segments ship to object storage for replication. |
| 12 | + |
| 13 | +### Bulk ingestion |
| 14 | + |
| 15 | +- **CSV ingestion:** |
| 16 | + QuestDB offers a CSV ingestion endpoint via the [REST API](/docs/reference/api/rest/) and web console. |
| 17 | + A specialized COPY command uses [io_uring](/blog/2022/09/12/importing-300k-rows-with-io-uring) on |
| 18 | + fast drives to speed up ingestion. |
| 19 | + |
| 20 | +### Real-time streaming |
| 21 | + |
| 22 | +- **High-frequency writes:** |
| 23 | + The streaming ingestion path handles millions of rows per second with non-blocking I/O. |
| 24 | + |
| 25 | +- **Durability:** |
| 26 | + As seen above, the system writes data to a row-based write-ahead log (WAL) and then converts it |
| 27 | + into column-based files for efficient reads. At the expense of performance, `sync` mode can be |
| 28 | + enabled on commit for extra durability. |
| 29 | + |
| 30 | +- **Concurrent writes:** |
| 31 | + Multiple connections writing to the same table create parallel WAL files that the engine |
| 32 | + later consolidates into columnar storage. |
| 33 | + |
| 34 | +```text |
| 35 | +
|
| 36 | +Contents of the `db` folder, showing multiple pending WAL files, |
| 37 | +and the binary columnar data. |
| 38 | +
|
| 39 | +├── db |
| 40 | +│ ├── Table |
| 41 | +│ │ │ |
| 42 | +│ │ ├── Partition 1 |
| 43 | +│ │ │ ├── _archive |
| 44 | +│ │ │ ├── column1.d |
| 45 | +│ │ │ ├── column2.d |
| 46 | +│ │ │ ├── column2.k |
| 47 | +│ │ │ └── ... |
| 48 | +│ │ ├── Partition 2 |
| 49 | +│ │ │ ├── _archive |
| 50 | +│ │ │ ├── column1.d |
| 51 | +│ │ │ ├── column2.d |
| 52 | +│ │ │ ├── column2.k |
| 53 | +│ │ │ └── ... |
| 54 | +│ │ ├── txn_seq |
| 55 | +│ │ │ ├── _meta |
| 56 | +│ │ │ ├── _txnlog |
| 57 | +│ │ │ └── _wal_index.d |
| 58 | +│ │ ├── wal1 |
| 59 | +│ │ │ └── 0 |
| 60 | +│ │ │ ├── _meta |
| 61 | +│ │ │ ├── _event |
| 62 | +│ │ │ ├── column1.d |
| 63 | +│ │ │ ├── column2.d |
| 64 | +│ │ │ └── ... |
| 65 | +│ │ ├── wal2 |
| 66 | +│ │ │ └── 0 |
| 67 | +│ │ │ │ ├── _meta |
| 68 | +│ │ │ │ ├── _event |
| 69 | +│ │ │ │ ├── column1.d |
| 70 | +│ │ │ │ ├── column2.d |
| 71 | +│ │ │ │ └── ... |
| 72 | +│ │ │ └── 1 |
| 73 | +│ │ │ ├── _meta |
| 74 | +│ │ │ ├── _event |
| 75 | +│ │ │ ├── column1.d |
| 76 | +│ │ │ ├── column2.d |
| 77 | +│ │ │ └── ... |
| 78 | +│ │ │ |
| 79 | +│ │ ├── _meta |
| 80 | +│ │ ├── _txn |
| 81 | +│ │ └── _cv |
| 82 | +
|
| 83 | +``` |
| 84 | + |
| 85 | +### Ingestion via ILP protocol |
| 86 | + |
| 87 | +- **Native ILP integration:** |
| 88 | + QuestDB supports the [Influx Line Protocol](/docs/reference/api/ilp/overview/) |
| 89 | + (ILP) for high-speed data ingestion. |
| 90 | + |
| 91 | +- **Extensions to ILP:** |
| 92 | + QuestDB extends ILP to support different timestamp units and the array data type. |
| 93 | + |
| 94 | +- **Minimal parsing overhead:** |
| 95 | + The ILP parser quickly maps incoming data to internal structures. |
| 96 | + |
| 97 | +- **Parallel ingestion:** |
| 98 | + The ILP path uses off-heap buffers and direct memory management to bypass JVM heap allocation. |
| 99 | + |
| 100 | +- **Protocol versatility:** |
| 101 | + In addition to ILP, QuestDB also supports ingestion via [REST](/docs/reference/sql/overview/#rest-http-api) |
| 102 | + and [PostgreSQL wire](/docs/reference/sql/overview/#postgresql) protocols. |
| 103 | + |
| 104 | + |
| 105 | +## Next Steps |
| 106 | + |
| 107 | +- Back to the [QuestDB Architecture](/docs/guides/architecture/questdb-architecture) overview |
| 108 | +- [QuestDB GitHub Repository](https://github.com/questdb/questdb) |
| 109 | +- [QuestDB Documentation](/docs) |
| 110 | + |
0 commit comments