@@ -7,25 +7,37 @@ description:
7
7
8
8
::: info
9
9
10
- Materialized View support is now generally available (GA) and ready for production use.
10
+ Materialized View support is now generally available (GA) and ready for
11
+ production use.
11
12
12
- If you are using versions earlier than ` 8.3.1 ` , we suggest you upgrade at your earliest convenience.
13
+ If you are using versions earlier than ` 8.3.1 ` , we suggest you upgrade at your
14
+ earliest convenience.
13
15
14
16
:::
15
17
16
18
` REFRESH MATERIALIZED VIEW ` refreshes a materialized view. This is helpful when
17
19
a view becomes invalid, and no longer refreshes incrementally.
18
20
19
- When the FULL keyword is specified, this command deletes the data in the target
20
- materialized view and inserts the results of the query into the view. It also
21
- marks the materialized view as valid, reactivating the incremental refresh
21
+ When the ` FULL ` keyword is specified, this command deletes the data in the
22
+ target materialized view and inserts the results of the query into the view. It
23
+ also marks the materialized view as valid, reactivating the incremental refresh
22
24
processes.
23
25
24
26
When the ` INCREMENTAL ` keyword is used, the ` REFRESH ` command schedules an
25
27
incremental refresh of the materialized view. Usually, incremental refresh is
26
28
automatic, so this command is useful only in niche situations when incremental
27
29
refresh is not working as expected, but the view is still valid.
28
30
31
+ When the ` INTERVAL ` keyword is specified, this command refreshes the data in the
32
+ specified time interval only. This command is useful for a valid materialized
33
+ view with configured
34
+ [ ` REFRESH LIMIT ` ] ( /docs/reference/sql/alter-mat-view-set-refresh-limit/ ) . That's
35
+ because inserted base table rows with timestamps older than the refresh limit
36
+ are ignored by incremental refresh, so interval refresh may be used to
37
+ recalculate materialized view on older rows. Interval refresh does not affect
38
+ incremental refresh, e.g. it does not update the last base table transaction
39
+ used by incremental refresh.
40
+
29
41
## Syntax
30
42
31
43
![ Flow chart showing the syntax of the REFRESH MATERIALIZED VIEW keyword] ( /images/docs/diagrams/refreshMatView.svg )
@@ -40,6 +52,10 @@ REFRESH MATERIALIZED VIEW trades_1h FULL;
40
52
REFRESH MATERIALIZED VIEW trades_1h INCREMENTAL;
41
53
```
42
54
55
+ ``` questdb-sql
56
+ REFRESH MATERIALIZED VIEW trades_1h INTERVAL FROM '2025-05-05T01:00:00.000000Z' TO '2025-05-05T02:00:00.000000Z';
57
+ ```
58
+
43
59
## See also
44
60
45
61
For more information on the concept, see the the
0 commit comments