Skip to content
Lucas Lessa
Voltar para as notícias
SnowflakeGAImpacto: Alto

Inline Stored Procedures for hybrid tables in Snowflake

Inline stored procedures run OLTP operations on hybrid tables as a single atomic unit, reducing overhead and latency.

O que mudou

Inline Stored Procedures are designed specifically for operational workloads on hybrid tables. The entire procedure body executes as a single atomic unit pushed directly to the query processing layer, reducing per-statement overhead and delivering low latency for OLTP transactions.### Use casesImagine you need to update records in a transactional orders table and write audit logs in the same transaction with high concurrency and low latency.- Wrap single DML operations for abstraction or access control.- Execute multi-statement OLTP transactions atomically.- Schedule recurring maintenance by calling the procedure from a Snowflake task.### How to use```sql CREATE OR REPLACE INLINE PROCEDURE place_order( order_id NUMBER(18,0), customer_id NUMBER(18,0), product VARCHAR, quantity NUMBER(10,0) ) RETURNS VARCHAR LANGUAGE SQL AS $$ BEGIN ATOMIC INSERT INTO orders (order_id, customer_id, product, quantity, status) VALUES (:order_id, :customer_id, :product, :quantity, 'PENDING'); RETURN 'OK'; END; $$

CALL place_order(1001, 42, 'Snowboard', 2);

1. The command creates a stored procedure using an atomic block.
2. The statement inserts data into the hybrid table using the passed arguments.
3. The procedure returns a confirmation string indicating success.### Limitations and requirementsThe feature is generally available (GA). They operate exclusively on hybrid tables; statements accessing standard Snowflake tables are not supported. Explicit BEGIN, COMMIT, or ROLLBACK statements are not allowed inside the procedure body since each invocation runs as an atomic block.
Ver nota oficial do Snowflake

Inline Stored Procedures for hybrid tables (General availability)

Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.

Relacionadas