Manage multiple workloads efficiently in RisingWave using database isolation, resource groups for dedicated compute resources, and cross-database queries for unified access.
database_A
is significantly less likely to halt or affect the checkpoint process for unrelated jobs in database_B
, assuming no direct cross-database dependencies are created (e.g., via cross-database materialized views, see below).--resource-group
command-line flag or by setting the RW_RESOURCE_GROUP
environment variable.
resource_group_A
crashes, it only impacts databases assigned to resource_group_A
. Databases in resource_group_B
(running on different CNs) remain unaffected by that specific hardware failure. This is crucial for ensuring the availability of critical applications.rg_high_cpu
using CNs optimized for CPU and rg_high_memory
using CNs with large RAM. Assign CPU-intensive jobs (like complex pattern matching) to rg_high_cpu
and memory-intensive jobs (like large stateful aggregations) to rg_high_memory
for optimal performance and efficient resource utilization.WITH RESOURCE_GROUP
clause when creating a database using CREATE DATABASE
. The named resource group must exist beforehand.
WITH resource_group
clause is omitted, the database is typically assigned to a default resource group, potentially sharing resources more broadly with other databases not explicitly assigned elsewhere.rw_resource_groups
: Lists defined groups and summarizes their assigned workers, parallelism, and the number of databases/jobs.
rw_streaming_jobs
: Shows active streaming jobs, including their database_id
and assigned resource_group
.
SELECT
statements.CREATE MATERIALIZED VIEW
) and Sinks (CREATE SINK
) that read from tables or MVs in other databases.CONNECT
, SELECT
, etc.) for secure access.CONNECT
privilege on the target (remote) database(s) they need to access.SELECT
or USAGE
) on the specific tables, views, or schemas being accessed in the remote database.superuser
bypasses these specific checks.SELECT
)database_name.schema_name.object_name
.
CREATE MV
, CREATE SINK
) - Requires subscriptionsCREATE SUBSCRIPTION
database_A
to react to ongoing changes in a table/MV from database_B
, it needs durable, cross-boundary access to the changelog of the source object in database_B
.CREATE SUBSCRIPTION
command makes this change stream persistently available across databases. Before creating an MV or Sink that reads from a table or MV in another database, you must first create at least one subscription for that specific upstream object in the source database. The upstream object must also have a primary key defined.CREATE MATERIALIZED VIEW
or CREATE SINK
operations.d1
), create a subscription for the upstream table (t1
):
d2
), create the cross-database MV:
DROP MATERIALIZED VIEW ... CASCADE
or DROP SINK ... CASCADE
operations are rejected if they have cross-database dependencies to prevent accidental data loss in the upstream database.orders_db
, customers_db
) for clarity and independent scaling, then use cross-database MVs in an analytics_db
for holistic views.CREATE DATABASE
(includes WITH RESOURCE_GROUP
)rw_resource_groups
, rw_streaming_jobs
)