RelationalAI Engine Management#

RelationalAI (RAI) engines are isolated compute units similar to Snowflake virtual warehouses. They execute queries on RAI schemas and process change data capture (CDC) streams. Like Snowflake warehouses, engines can be independently created for workload isolation or scaling.

Managing Engine Compute Pools#

RAI engines are hosted in Snowflake compute pools. The size of the engine is determined by the compute pool’s INSTANCE_FAMILY. Currently, RAI supports two instance families:

Instance FamilyRAI Engine SizeDescription
HIGHMEM_X64_SHighMem|SHosts small engines.
HIGHMEM_X64_MHighMem|MHosts medium engines.

When users create engines, they must specify the compute pool that hosts the engine. To ensure availability, we recommend creating one compute pool for each engine size that you plan to use. USAGE and MONITOR privileges must be granted to the RAI Native App for each compute pool:

-- Compute pool for 'HighMem|S' engines.
CREATE COMPUTE POOL IF NOT EXISTS rai_engine_pool_s
    FOR APPLICATION relationalai
    MIN_NODES = 1
    MAX_NODES = 10
    AUTO_RESUME = TRUE
    AUTO_SUSPEND_SECS = 300
    INSTANCE_FAMILY = HIGHMEM_X64_S;
-- Grant usage and monitoring privileges to the RAI Native App.
GRANT USAGE, MONITOR ON COMPUTE POOL rai_engine_pool_s TO APPLICATION relationalai;

-- Compute pool for 'HighMem|M' engines.
CREATE COMPUTE POOL IF NOT EXISTS rai_engine_pool_m
    FOR APPLICATION relationalai
    MIN_NODES = 1
    MAX_NODES = 10
    AUTO_RESUME = TRUE
    AUTO_SUSPEND_SECS = 300
    INSTANCE_FAMILY = HIGHMEM_X64_M;
-- Grant usage and monitoring privileges to the RAI Native App.
GRANT USAGE, MONITOR ON COMPUTE POOL rai_engine_pool_m TO APPLICATION relationalai;
TIP

Adjusting the AUTO_SUSPEND_SECS parameter helps balance cost control with availability for engine provisioning. See Cost Management for details on how costs are accrued.

Managing Engines#

You can manage engines using the RAI CLI or SQL procedures provided by the RAI Native App. To manage engines, you must have eng_admin application role privileges.

Create an Engine#

Use the create_engine() procedure to create an engine:

CALL relationalai.api.create_engine('<engine_name>', '<compute_pool_name>', '<engine_size>');

The engine size must match the compute pool’s INSTANCE_FAMILY:

By default, engines can’t access endpoints outside of your Snowflake account. Refer to the reference docs for details on enabling external integrations.

Get Engine Details#

Use the get_engine() procedure to get details about an engine:

-- NOTE: Engine names are case-sensitive.
CALL relationalai.api.get_engine('<engine_name>');

Delete an Engine#

To delete an engine, use the delete_engine() procedure:

-- NOTE: Engine names are case-sensitive.
CALL relationalai.api.delete_engine('<engine_name>');

You cannot delete an engine that is currently used to process CDC streams. To delete a CDC engine, use the setup_cdc() procedure to reassign the stream to another engine before deleting the original engine.

List All Engines#

To view a list of all engines you have access to, query the engines view:

SELECT * FROM relationalai.api.engines;

Performance Considerations#

This section provides an overview of performance considerations and outlines best practices for managing engine workloads effectively.

Managing Concurrent Workloads#

Engines provide performance isolation, but load balancing is manual. When multiple workloads run concurrently on the same engine, they may affect each other’s performance. To avoid coordination issues, use separate engines for different workloads.

Each engine can handle up to 8 queries concurrently and has a queue capacity of up to 128 transactions, with a first-in/first-out priority. However, resource-intensive queries execute sequentially.

The RAI Native App’s service warehouse allocates compute resources for queries. Adjust the warehouse’s MAX_CONCURRENCY_LEVEL to limit the number of concurrent queries across all engines.

NOTE

The RAI service warehouse’s default MAX_CONCURRENCY_LEVEL is 8. Increasing this limit allows more concurrent queries but may affect performance. Lowering it can improve performance by reducing resource competition. For more details, see the Snowflake documentation.

Monitoring Queries#

Use the RAI CLI’s transactions:list command to monitor queries:

rai transactions:list

Take note of the following statuses. While occasional occurrences are normal, a high volume may indicate potential issues:

Best Practices#