Materialized View for CAP NodeJS Runtime
cds-materialized-view
depends on the cds-mtxs
features/services, so MUST setup cds-mtxs
firstly.
enable plugin
{
"cds": {
"plugins": ["cds-materialized-view"],
"materialized": {
"view": {
"refresh": {
"interval": 1800
}
}
}
}
}
then annotate some view with annotations
namespace test.resources.csv.app.db;
entity Person {
key ID : Integer;
Name : String(255);
}
@cds.materialized.view // create materialized view
@cds.materialized.interval : 3600 // refresh interval: per hour
view UniqPersonNames as select distinct Name from Person;
now, it works!
cds.materialized.view.refresh.jobs
- defaulttrue
- enable job to refresh views, typically maybe need to setup only one instance to run the jobscds.materialized.view.refresh.interval
- default3600 seconds
- default global refresh interval for materialized view, for each view developer could use@cds.materialized.interval
annotation to overwrite thiscds.materialized.view.refresh.concurrency
- default10
- concurrency of materialized view refreshcds.materialized.check.view.interval
- default1 second
- interval between collect views need to be refreshed, then refresh themcds.materialized.view.refresh.header
- defaultfalse
- addx-cds-materialized-view-refresh-at
header to response
- support materialized view
- create table for materialized view
- rewrite query
- rewrite string query
- rewrite array query
- filter
- aggregation
- view join table
- virtual elements
- projection join
- shortcut for
$count
query- hottest query
- count all
- support
x-cds-materialized-view-refresh-at
- support reuse existed materialized view
- support to
redirect
to existed materialized view - support new service(interface) to support refresh materialized view by API/Rest API