SET RW_IMPLICIT_FLUSH
The RW_IMPLICIT_FLUSH
configuration option controls the behavior of implicit flushes after batch operations.
Syntax
SET RW_IMPLICIT_FLUSH = { true | false };
Purpose
The FLUSH
command commits any pending data changes and forces RisingWave to persist updated data to storage, which guarantees subsequent reads can access the latest data. See details in FLUSH
.
However, when the RW_IMPLICIT_FLUSH
option is enabled, explicit use of the FLUSH
command is not required in most cases, as data changes are implicitly flushed and made visible after batch operations.
Behavior
-
When
RW_IMPLICIT_FLUSH
is set totrue
,- Data changes through
INSERT
,UPDATE
, andDELETE
are implicitly flushed and made visible after batch operations. - RisingWave ensures that data consistency and visibility are maintained similar to traditional databases, where read-after-write guarantees are provided.
- Data changes through
-
When
RW_IMPLICIT_FLUSH
is set tofalse
(default behavior),- RisingWave does not guarantee read-after-write consistency — a write may not be visible to subsequent reads immediately.
- You need to call
FLUSH
explicitly after batch operations to immediately persist the changes to storage.
Example
-- Enable RW_IMPLICIT_FLUSH
SET RW_IMPLICIT_FLUSH TO true;
-- Perform batch operations
INSERT INTO users (id, name) VALUES (1, 'Alice'), (2, 'Bob'), (3, 'Charlie');
UPDATE users SET name = 'David' WHERE id = 2;
DELETE FROM users WHERE id = 3;
-- Data changes are implicitly flushed and immediately visible
SELECT * FROM users;