Best Practices

Here are some best practices to manage performance tradeoffs between transactions and analytics using SingleStore Kai.

Enable JSON key order

SingleStoreDB does not preserve the JSON key order by default. This does not impact most applications and improves performance. If your application requires key order to be preserved, you can preserve the JSON key order at both the database and collection levels.

  • Database level: To preserve JSON key order for a database, run the following command:

  • Collection level: To preserve JSON key order for a specific collection (for example, mycollection), run the following command:


Faster Transactions (But Lower Resilience)

SingleStoreDB enables retryWrites by default, which provides higher resilience against network errors. Disabling the retryWrites setting will improve latency for write operations, but the application might need to manually handle errors due to transient network conditions.


SingleStoreDB recommends leaving retryWrites enabled for ingesting data.

Last modified: July 11, 2023

Was this article helpful?