CrateDB need timeout to see changes from insert/update/delete queries

Hi, I am using the CrateDB community edition to build a pilot project. Currently, I have this problem, if I make a select query right after making insert/update/delete ones, the select will return nothing changes. However, if I wait for few seconds, the select query will return changes in DB. This problem degrades the speed of our application dramatically.
How can we fix this problem?
Thank you in advance!

1 Like

Hi @minh86

Welcome to the Crate Community.

Because of the underlying append only index / data structure of CrateDB / Lucene, changes are only available after a Refresh or a Flush. By default the refresh_interval - a table level setting - is set to 1000ms. Meaning that after max 1s the newest changes are guaranteed to be available. You can manually trigger a refresh on a table with the following SQL command:

REFRESH TABLE (table_ident [ PARTITION (partition_column=value [ , ... ])] [, ...] )

If you are doing lots of updates / deletes or instantly need the newest changes to always be available, there might be better options than CrateDB :wink:



Thank you very much for your detailed answer!
Best Wish!