You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*`fetch_latest_metadata` (`?boolean`) - guarantees the
871
-
up-to-date metadata (space format) in first return value, otherwise
872
-
it may not take into account the latest migration of the data format.
877
+
up-to-date metadata (space format) in first return value, otherwise
878
+
it may not take into account the latest migration of the data format.
873
879
Performance overhead is up to 15%. `false` by default
874
880
875
881
Returns metadata and array of errors.
@@ -1014,8 +1020,8 @@ where:
1014
1020
*`yield_every` (`?number`) - number of tuples processed on storage to yield after,
1015
1021
`yield_every` should be > 0, default value is 1000
1016
1022
*`fetch_latest_metadata` (`?boolean`) - guarantees the
1017
-
up-to-date metadata (space format) in first return value, otherwise
1018
-
it may not take into account the latest migration of the data format.
1023
+
up-to-date metadata (space format) in first return value, otherwise
1024
+
it may not take into account the latest migration of the data format.
1019
1025
Performance overhead is up to 15%. `false` by default
1020
1026
1021
1027
@@ -1541,6 +1547,198 @@ support preserving stats between role reload
1541
1547
(see [tarantool/metrics#334](https://github.com/tarantool/metrics/issues/334)),
1542
1548
thus this feature will be unsupported for `metrics` driver.
1543
1549
1550
+
### Read view
1551
+
1552
+
A read view is an in-memory snapshot of the entire database that isn’t affected by future data modifications. Read views allow you to retrieve data using the `read_view_object:select()` and `read_view_object:pairs()` operations.
1553
+
1554
+
Read views can be used to make complex analytical queries. This reduces the load on the main database and improves RPS for a single Tarantool instance.
1555
+
1556
+
To improve memory consumption and performance, Tarantool creates read views using the copy-on-write technique. In this case, duplication of the entire data set is not required: Tarantool duplicates only blocks modified after a read view is created
1557
+
1558
+
Read views have the following limitations:
1559
+
1560
+
* Only the memtx engine is supported.
1561
+
* Read view can be used starting from Tarantool Enterprise v2.11.0.
1562
+
1563
+
#### Creating a read view
1564
+
1565
+
To create a read view, call the `crud.readview()` function.
1566
+
1567
+
```lua
1568
+
localfoo=crud.readview(opts)
1569
+
```
1570
+
1571
+
where:
1572
+
1573
+
*`opts`:
1574
+
*`name` (`?string`) - name of the read view
1575
+
*`timeout` (`?number`) - `vshard.call` timeout (in seconds)
1576
+
1577
+
**Example:**
1578
+
1579
+
```lua
1580
+
localfoo=crud.readview({name: 'foo', timeout: 3})
1581
+
```
1582
+
1583
+
#### Closing a read view
1584
+
1585
+
When a read view is no longer needed, close it using the `read_view_object:close()` method because a read view may consume a substantial amount of memory.
1586
+
1587
+
```lua
1588
+
localfoo=foo.readview()
1589
+
foo:close(opts)
1590
+
```
1591
+
1592
+
where:
1593
+
1594
+
*`opts`:
1595
+
*`timeout` (`?number`) - `vshard.call` timeout (in seconds)
1596
+
1597
+
Otherwise, a read view is closed implicitly when the read view object is collected by the Lua garbage collector.
1598
+
1599
+
**Example:**
1600
+
1601
+
```lua
1602
+
localfoo=crud.readview()
1603
+
foo:close({timeout=3})
1604
+
```
1605
+
1606
+
#### Read view select
1607
+
1608
+
`read_view_object:select()` supports multi-conditional selects, treating a cluster as a single space, same as `crud.select`.
0 commit comments