Skip to content

Reactive Views

A reactive view is an always-up-to-date SQL view, backed by SKDB's incremental evaluation engine. This is roughly equivalent to "materialized views" in other databases.

Reactive views are proactive, providing real-time data insights. They are advantageous on both client and server sides. Their critical role in the permission model makes them indispensable on the server side.

Here is an example of creating reactive views:

// This view will keep an up-to-date count of users available, even as the
// underlying 'users' table changes
localDb.exec("CREATE REACTIVE VIEW userCounts AS SELECT COUNT(*) FROM users");

// Reactive views can also be created on the server
remoteSkdb.exec("CREATE REACTIVE VIEW userCounts AS SELECT COUNT(*) FROM users");