Notebook usage¶

Notebooks consume compute resources through their configured virtual warehouses or compute pools. To manage cost and ensure efficiency, it’s important to monitor usage across individual notebooks, users, and the underlying compute infrastructure.

Tracking usage at the notebook, user, and compute resource level supports workload optimization and cost accountability across your environment.

For a detailed overview of cost management, see Exploring compute cost.

Example query¶

You can query Snowflake’s ACCOUNT_USAGE views to gain insight into the credit consumption for a notebook. These views break down cost by notebook, user, or compute pool level at a daily or hourly basis.

Usage¶

In the example, each row represents a single notebook execution and includes details such as the execution timestamp, the user who ran the notebook, and the runtime environment (Warehouse or Container Runtime).

-- Warehouse Runtime
SELECT query_text, t1.user_name, credits_attributed_compute as total_warehouse_credits
FROM snowflake.account_usage.query_history t1
INNER JOIN snowflake.account_usage.query_attribution_history t2
ON t1.query_id = t2.query_id

-- Add your notebook name
AND t1.query_text ILIKE 'execute notebook% <example_nb_name>'
;

-- Container Runtime
SELECT
  start_time, notebook_name, user_name, SUM(credits) AS total_container_runtime_credits
FROM snowflake.account_usage.notebooks_container_runtime_history
WHERE notebook_name = ‘<example_nb_name>’
GROUP BY ALL;
Copy