Skip to content

Commit

Permalink
Update _index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
otoolep committed Mar 11, 2024
1 parent 033b859 commit 24a7a6e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions content/en/docs/API/non-deterministic/_index.md
Expand Up @@ -23,10 +23,11 @@ An rqlite node addresses this issue by _rewriting_ received SQL statements that
### `RANDOM()`

Any SQL statement containing `RANDOM()` is rewritten following these rules:
- the statement is part of a write-request i.e. the request is sent to the `/db/execute` HTTP API.
- the statement is part of a read-request i.e. the request is sent to the `/db/query` HTTP API **and** the read-request is made with _strong_ read consistency.
- if `RANDOM()` is used as an `ORDER BY` qualifier it is not rewritten.
- the HTTP request containing the SQL statement does not have the query parameter `norwrandom` present.
- The statement is part of a write-request i.e. the request is sent to the `/db/execute` HTTP API.
- The statement is part of a read-request i.e. the request is sent to the `/db/query` HTTP API **and** the read-request is made with _strong_ read consistency.
- If `RANDOM()` is used as an `ORDER BY` qualifier it is not rewritten.
- This does mean that certain `INSERT` statements are not rewritten e.g. `INSERT INTO foo (x) SELECT x FROM bar ORDER BY RANDOM()`. Executing such a statement may result in different data under each node.
- The HTTP request containing the SQL statement does not have the query parameter `norwrandom` present.

`RANDOM()` is replaced with a random integer between -9223372036854775808 and +9223372036854775807 by the rqlite node that first receives the SQL statement.

Expand Down

0 comments on commit 24a7a6e

Please sign in to comment.