HFT Tables: Batch Writing

Enabling Batch Writing

Syntax & Example

ENABLE BATCH WRITING ON TABLE btc_ticks TICKS 1000;

To minimize disk write congestion during high-frequency trading, you can enable buffered batch writing on any HFT table. Here, user needs to mention two things table name ("btc_ticks") and the batch size (1000). The statement configures the table to hold tick updates in-memory and flush them as a single bulk write using asynchronous Linux kernel I/O (io_uring) every N ticks (e.g. 1000). This batch writing exists only till system restart. Once system is restarted, you need to enable batch writing again.

Disabling Batch Writing

Syntax & Example

DISABLE BATCH WRITING ON TABLE btc_ticks;

The users can disable the batch writing by using the above command. For this they only need to select that database and need the table name (btc_ticks).