Getting Started With Interactive Tables
Getting Started with Interactive Tables
Load libraries and define custom functions
Firstly, make sure to have prerequisite libraries installed in your Snowflake Notebook environment.
To do this, click on Packages and add the following packages to the Anaconda Packages tab:
matplotlibtabulate
Setting up connection to a Snowflake deployment and verifying versions
Here, we'll connect to Snowflake and verify the version and confirm that key interactive features are enabled, before setting the active database and role for the session.
Create an interactive warehouse & Turn it on

Next, let's create our interactive_demo_b warehouse and immediately turn it on:
The Data
Run setup.sql to setup the database that we'll need for the forthcoming tutorial. After running the setup script, you'll have created the MY_DEMO_DB database and BENCHMARK_FDN schema that houses the HITS2_CSV table.
Create an interactive table

Now, we'll use the WH warehouse to efficiently create our new interactive CUSTOMERS table by copying all the data from the original standard table:
Attach interactive table to a warehouse

Next, we'll attach our interactive table to the warehouse, which pre-warms the data cache for optimal query performance:
Run queries with interactive warehouse

Now, we'll run our first performance test on the interactive setup by executing a page-view query, timing its execution, and then plotting the results.
We'll start by activating the interactive warehouse and disabling the result cache:
Next, we'll run a query to find the top 10 most viewed pages for July 2013, measures how long it takes, and then plots the results and execution time:
Compare to a standard warehouse

To establish a performance baseline, we'll run an identical page-view query on a standard warehouse to measure and plot its results for comparison.
We'll start by preparing the session for a performance benchmark by selecting a standard WH warehouse, disabling the result cache, and setting the active database:
Here, we'll run a top 10 page views analysis by executing the query, measuring its performance, and immediately plotting the results and execution time:
Run some queries concurrently
To directly compare performance, we'll benchmark both the interactive and standard warehouses over several runs and then plot their latencies side-by-side in a grouped bar chart: