In this post we are going to cover SHOW, DESCRIBE and COMMENT in Snowflake.
SHOW lists objects. DESCRIBE lists what is inside one. COMMENT is how you write down what a thing is for. They are three commands everybody learns in the first week and then stops thinking about, because their output looks like a report you can only read with your eyes.
It is not a report. One function turns it into a table you can filter, count, sum and join, and once it is a table SHOW and the catalog start disagreeing with each other in the open.
We will start with the plainest SHOW there is and build it up step by step.
Every query below was run on a real Snowflake account, and every result you see is the output it gave back.
Episode 112 of the Snowflake SQL: Zero to Hero series on TechBrothersIT.
- Let's create something to look at
- Let's start with SHOW TABLES
- Can we put a WHERE clause on it?
- Now let's wrap it and make it a table
- Now that both are queryable, they disagree
- Let's DESCRIBE the table
- Does DESCRIBE VIEW work on a table?
- Now the one worth the episode: DESCRIBE RESULT
- So where do comments actually live?
- Let's add a comment after the fact
- Does a comment survive a change to the column?
- What happens if we set a comment to an empty string?
- And SHOW COLUMNS answers in JSON
- One more: SHOW VIEWS, and what it quietly includes
- So which command should you count with?
- One last thing: let's tidy up
Let's create something to look at
We want an object with some description on it, so there is something for DESCRIBE to find. The table below has a comment on itself and a comment on three of its four columns. ISSUED deliberately has none, because we are going to come back and give it one later.
There is also a view over the table, and a second table with nothing in it, so that we have more than one kind of object to count.
-- Sample data for this post.
-- A table with a comment on itself and on three of its four columns, three
-- rows in it, a view over it, and a second table with nothing in it.
USE DATABASE DEMO_DB;
USE SCHEMA PUBLIC;
CREATE OR REPLACE TABLE INVOICES_T112 (
INVOICE_ID INT COMMENT 'the invoice number, not gapless',
CUSTOMER VARCHAR(40) COMMENT 'who it is for',
AMOUNT NUMBER(10,2) COMMENT 'gross, in account currency',
ISSUED DATE
) COMMENT = 'episode 112 probe table';
INSERT INTO INVOICES_T112 (INVOICE_ID, CUSTOMER, AMOUNT, ISSUED)
SELECT 1001, 'Ana Ltd', 120.00, '2026-01-15'::DATE UNION ALL
SELECT 1002, 'Ben GmbH', 340.50, '2026-02-02'::DATE UNION ALL
SELECT 1003, 'Cleo SA', 75.25, '2026-02-19'::DATE;
CREATE OR REPLACE VIEW BIG_INVOICES_T112
COMMENT = 'invoices over 100'
AS SELECT INVOICE_ID, CUSTOMER, AMOUNT
FROM INVOICES_T112
WHERE AMOUNT > 100;
CREATE OR REPLACE TABLE PAYMENTS_T112 (
PAYMENT_ID INT,
INVOICE_ID INT,
PAID NUMBER(10,2)
);Let's start with SHOW TABLES
The plainest version lists every table in the schema.
SHOW TABLES IN SCHEMA PUBLIC;| created_on | name | database_name | schema_name | kind | comment | cluster_by | rows | bytes | owner | retention_time | automatic_clustering | change_tracking | search_optimization | search_optimization_progress | search_optimization_bytes | is_external | enable_schema_evolution | owner_role_type | is_event | is_hybrid | is_iceberg | is_dynamic | is_immutable | is_interactive | row_timestamp | error_logging |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-09-28 18:27:08.999000-07:00 | CUSTOMERS | DEMO_DB | PUBLIC | TABLE | 10 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:07.395000-07:00 | DEPARTMENTS | DEMO_DB | PUBLIC | TABLE | 4 | 1024 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:15.165000-07:00 | DOCS_XML | DEMO_DB | PUBLIC | TABLE | 4 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:08.115000-07:00 | EMPLOYEES | DEMO_DB | PUBLIC | TABLE | 8 | 2048 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:11.646000-07:00 | EVENTS_JSON | DEMO_DB | PUBLIC | TABLE | 4 | 3072 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:17.808000-07:00 | INVOICES_T112 | DEMO_DB | PUBLIC | TABLE | episode 112 probe table | 3 | 1024 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | |
| 2026-09-27 03:50:28.146000-07:00 | JSON_LOADED | DEMO_DB | PUBLIC | TABLE | 11 | 2560 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:14.430000-07:00 | JSON_TEXT_RAW | DEMO_DB | PUBLIC | TABLE | 11 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:09.808000-07:00 | ORDERS | DEMO_DB | PUBLIC | TABLE | 41 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:18.914000-07:00 | PAYMENTS_T112 | DEMO_DB | PUBLIC | TABLE | 0 | 0 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:10.959000-07:00 | SALES_RAW | DEMO_DB | PUBLIC | TABLE | 8 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:16.148000-07:00 | TYPED_SHAPES | DEMO_DB | PUBLIC | TABLE | 2 | 2560 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-27 20:10:07.808000-07:00 | XML_LOADED | DEMO_DB | PUBLIC | TABLE | 4 | 4096 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF |
Our two tables are in there along with everything else the schema holds from earlier posts. It is a wide grid: created_on, name, kind, comment, rows and bytes are the ones people read, and the rest are flags.
If that is too much, there is a shorter form.
SHOW TERSE TABLES IN SCHEMA PUBLIC;| created_on | name | kind | database_name | schema_name |
|---|---|---|---|---|
| 2026-09-28 18:27:08.999000-07:00 | CUSTOMERS | TABLE | DEMO_DB | PUBLIC |
| 2026-09-28 18:27:07.395000-07:00 | DEPARTMENTS | TABLE | DEMO_DB | PUBLIC |
| 2026-09-28 18:27:15.165000-07:00 | DOCS_XML | TABLE | DEMO_DB | PUBLIC |
| 2026-09-28 18:27:08.115000-07:00 | EMPLOYEES | TABLE | DEMO_DB | PUBLIC |
| 2026-09-28 18:27:11.646000-07:00 | EVENTS_JSON | TABLE | DEMO_DB | PUBLIC |
| 2026-09-28 18:27:17.808000-07:00 | INVOICES_T112 | TABLE | DEMO_DB | PUBLIC |
| 2026-09-27 03:50:28.146000-07:00 | JSON_LOADED | TABLE | DEMO_DB | PUBLIC |
| 2026-09-28 18:27:14.430000-07:00 | JSON_TEXT_RAW | TABLE | DEMO_DB | PUBLIC |
| 2026-09-28 18:27:09.808000-07:00 | ORDERS | TABLE | DEMO_DB | PUBLIC |
| 2026-09-28 18:27:18.914000-07:00 | PAYMENTS_T112 | TABLE | DEMO_DB | PUBLIC |
| 2026-09-28 18:27:10.959000-07:00 | SALES_RAW | TABLE | DEMO_DB | PUBLIC |
| 2026-09-28 18:27:16.148000-07:00 | TYPED_SHAPES | TABLE | DEMO_DB | PUBLIC |
| 2026-09-27 20:10:07.808000-07:00 | XML_LOADED | TABLE | DEMO_DB | PUBLIC |
TERSE gives the same list of tables with a handful of columns instead of the full set. Nothing is filtered out. Only the width changed.
Can we put a WHERE clause on it?
We only want the two tables from this post, and the obvious way to ask for that is a WHERE clause. Let's try.
SHOW TABLES IN SCHEMA PUBLIC WHERE "name" LIKE '%T112';001003 (42000): SQL compilation error: syntax error line 1 at position 29 unexpected 'WHERE'.
syntax error, unexpected 'WHERE'. A SHOW does not take one.
So let's treat it as a table and select from it instead.
SELECT "name" FROM SHOW TABLES IN SCHEMA PUBLIC;001003 (42000): SQL compilation error: syntax error line 1 at position 31 unexpected 'IN'.
Also a syntax error. You cannot select from a SHOW either.
SHOW has exactly one filter of its own, and it is LIKE.
SHOW TABLES LIKE '%T112' IN SCHEMA PUBLIC;| created_on | name | database_name | schema_name | kind | comment | cluster_by | rows | bytes | owner | retention_time | automatic_clustering | change_tracking | search_optimization | search_optimization_progress | search_optimization_bytes | is_external | enable_schema_evolution | owner_role_type | is_event | is_hybrid | is_iceberg | is_dynamic | is_immutable | is_interactive | row_timestamp | error_logging |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-09-28 18:27:17.808000-07:00 | INVOICES_T112 | DEMO_DB | PUBLIC | TABLE | episode 112 probe table | 3 | 1024 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | |
| 2026-09-28 18:27:18.914000-07:00 | PAYMENTS_T112 | DEMO_DB | PUBLIC | TABLE | 0 | 0 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF |
That is what we wanted, and it is as far as most people ever get. It works, but a pattern on the name is all it can do. You cannot filter on the row count, you cannot sort it, and you cannot count what comes back.
Now let's wrap it and make it a table
Here is the thing that changes the whole picture. The output of any query is kept for a while and can be fetched again by its id. LAST_QUERY_ID() gives us the id of the statement we just ran, and RESULT_SCAN hands back its result as a table.
So first we run the SHOW, so that it is the last thing that ran.
SHOW TABLES IN SCHEMA PUBLIC;| created_on | name | database_name | schema_name | kind | comment | cluster_by | rows | bytes | owner | retention_time | automatic_clustering | change_tracking | search_optimization | search_optimization_progress | search_optimization_bytes | is_external | enable_schema_evolution | owner_role_type | is_event | is_hybrid | is_iceberg | is_dynamic | is_immutable | is_interactive | row_timestamp | error_logging |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-09-28 18:27:08.999000-07:00 | CUSTOMERS | DEMO_DB | PUBLIC | TABLE | 10 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:07.395000-07:00 | DEPARTMENTS | DEMO_DB | PUBLIC | TABLE | 4 | 1024 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:15.165000-07:00 | DOCS_XML | DEMO_DB | PUBLIC | TABLE | 4 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:08.115000-07:00 | EMPLOYEES | DEMO_DB | PUBLIC | TABLE | 8 | 2048 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:11.646000-07:00 | EVENTS_JSON | DEMO_DB | PUBLIC | TABLE | 4 | 3072 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:17.808000-07:00 | INVOICES_T112 | DEMO_DB | PUBLIC | TABLE | episode 112 probe table | 3 | 1024 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | |
| 2026-09-27 03:50:28.146000-07:00 | JSON_LOADED | DEMO_DB | PUBLIC | TABLE | 11 | 2560 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:14.430000-07:00 | JSON_TEXT_RAW | DEMO_DB | PUBLIC | TABLE | 11 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:09.808000-07:00 | ORDERS | DEMO_DB | PUBLIC | TABLE | 41 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:18.914000-07:00 | PAYMENTS_T112 | DEMO_DB | PUBLIC | TABLE | 0 | 0 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:10.959000-07:00 | SALES_RAW | DEMO_DB | PUBLIC | TABLE | 8 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:16.148000-07:00 | TYPED_SHAPES | DEMO_DB | PUBLIC | TABLE | 2 | 2560 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-27 20:10:07.808000-07:00 | XML_LOADED | DEMO_DB | PUBLIC | TABLE | 4 | 4096 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF |
And now we select from it, with a WHERE clause and an ORDER BY, like any other table.
SELECT "name", "rows", "bytes", "comment"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "name" LIKE '%T112'
ORDER BY "name";| name | rows | bytes | comment |
|---|---|---|---|
| INVOICES_T112 | 3 | 1024 | episode 112 probe table |
| PAYMENTS_T112 | 0 | 0 |
Four columns, two rows, filtered the way we asked. INVOICES_T112 reports its rows, its bytes and its comment. PAYMENTS_T112 has no comment, and SHOW reports that as an empty string rather than as a NULL. Hold on to that, because the catalog does not agree.
Have a look at the double quotes around "name", "rows", "bytes" and "comment". A SHOW returns its column names in lower case, and a lower case identifier has to be quoted or Snowflake will look for the upper case one and not find it. That is the only awkward part of this, and it is the whole trick.
And if it is a table, it aggregates. Let's run the SHOW again and count instead of listing.
SHOW TABLES IN SCHEMA PUBLIC;| created_on | name | database_name | schema_name | kind | comment | cluster_by | rows | bytes | owner | retention_time | automatic_clustering | change_tracking | search_optimization | search_optimization_progress | search_optimization_bytes | is_external | enable_schema_evolution | owner_role_type | is_event | is_hybrid | is_iceberg | is_dynamic | is_immutable | is_interactive | row_timestamp | error_logging |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-09-28 18:27:08.999000-07:00 | CUSTOMERS | DEMO_DB | PUBLIC | TABLE | 10 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:07.395000-07:00 | DEPARTMENTS | DEMO_DB | PUBLIC | TABLE | 4 | 1024 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:15.165000-07:00 | DOCS_XML | DEMO_DB | PUBLIC | TABLE | 4 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:08.115000-07:00 | EMPLOYEES | DEMO_DB | PUBLIC | TABLE | 8 | 2048 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:11.646000-07:00 | EVENTS_JSON | DEMO_DB | PUBLIC | TABLE | 4 | 3072 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:17.808000-07:00 | INVOICES_T112 | DEMO_DB | PUBLIC | TABLE | episode 112 probe table | 3 | 1024 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | |
| 2026-09-27 03:50:28.146000-07:00 | JSON_LOADED | DEMO_DB | PUBLIC | TABLE | 11 | 2560 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:14.430000-07:00 | JSON_TEXT_RAW | DEMO_DB | PUBLIC | TABLE | 11 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:09.808000-07:00 | ORDERS | DEMO_DB | PUBLIC | TABLE | 41 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:18.914000-07:00 | PAYMENTS_T112 | DEMO_DB | PUBLIC | TABLE | 0 | 0 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:10.959000-07:00 | SALES_RAW | DEMO_DB | PUBLIC | TABLE | 8 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:16.148000-07:00 | TYPED_SHAPES | DEMO_DB | PUBLIC | TABLE | 2 | 2560 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-27 20:10:07.808000-07:00 | XML_LOADED | DEMO_DB | PUBLIC | TABLE | 4 | 4096 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF |
SELECT COUNT(*) AS TABLES_MATCHING,
SUM("rows") AS ROWS_BETWEEN_THEM
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "name" LIKE '%T112';| TABLES_MATCHING | ROWS_BETWEEN_THEM |
|---|---|
| 2 | 3 |
A COUNT and a SUM over the output of a SHOW. That is the episode, and everything else is a consequence of it.
Now that both are queryable, they disagree
There are two ways to ask what is in a schema. We have just made one of them countable, so let's ask both the same question with the same filter.
SHOW TABLES IN SCHEMA PUBLIC;| created_on | name | database_name | schema_name | kind | comment | cluster_by | rows | bytes | owner | retention_time | automatic_clustering | change_tracking | search_optimization | search_optimization_progress | search_optimization_bytes | is_external | enable_schema_evolution | owner_role_type | is_event | is_hybrid | is_iceberg | is_dynamic | is_immutable | is_interactive | row_timestamp | error_logging |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-09-28 18:27:08.999000-07:00 | CUSTOMERS | DEMO_DB | PUBLIC | TABLE | 10 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:07.395000-07:00 | DEPARTMENTS | DEMO_DB | PUBLIC | TABLE | 4 | 1024 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:15.165000-07:00 | DOCS_XML | DEMO_DB | PUBLIC | TABLE | 4 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:08.115000-07:00 | EMPLOYEES | DEMO_DB | PUBLIC | TABLE | 8 | 2048 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:11.646000-07:00 | EVENTS_JSON | DEMO_DB | PUBLIC | TABLE | 4 | 3072 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:17.808000-07:00 | INVOICES_T112 | DEMO_DB | PUBLIC | TABLE | episode 112 probe table | 3 | 1024 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | |
| 2026-09-27 03:50:28.146000-07:00 | JSON_LOADED | DEMO_DB | PUBLIC | TABLE | 11 | 2560 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:14.430000-07:00 | JSON_TEXT_RAW | DEMO_DB | PUBLIC | TABLE | 11 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:09.808000-07:00 | ORDERS | DEMO_DB | PUBLIC | TABLE | 41 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:18.914000-07:00 | PAYMENTS_T112 | DEMO_DB | PUBLIC | TABLE | 0 | 0 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:10.959000-07:00 | SALES_RAW | DEMO_DB | PUBLIC | TABLE | 8 | 1536 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-28 18:27:16.148000-07:00 | TYPED_SHAPES | DEMO_DB | PUBLIC | TABLE | 2 | 2560 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF | ||
| 2026-09-27 20:10:07.808000-07:00 | XML_LOADED | DEMO_DB | PUBLIC | TABLE | 4 | 4096 | ACCOUNTADMIN | 1 | OFF | OFF | OFF | NULL | NULL | N | N | ROLE | N | N | N | N | N | N | OFF | OFF |
SELECT COUNT(*) AS OBJECTS_FROM_SHOW_TABLES
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "name" LIKE '%T112';| OBJECTS_FROM_SHOW_TABLES |
|---|
| 2 |
Now the catalog view.
SELECT TABLE_NAME, TABLE_TYPE, ROW_COUNT, COMMENT
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'PUBLIC' AND RIGHT(TABLE_NAME, 5) = '_T112'
ORDER BY TABLE_NAME;| TABLE_NAME | TABLE_TYPE | ROW_COUNT | COMMENT |
|---|---|---|---|
| BIG_INVOICES_T112 | VIEW | NULL | invoices over 100 |
| INVOICES_T112 | BASE TABLE | 3 | episode 112 probe table |
| PAYMENTS_T112 | BASE TABLE | 0 | NULL |
A different answer. There is a third object matching that pattern, and the second column says why: BIG_INVOICES_T112 is a VIEW. INFORMATION_SCHEMA.TABLES includes views. SHOW TABLES does not.
SELECT TABLE_TYPE, COUNT(*) AS HOW_MANY
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'PUBLIC' AND RIGHT(TABLE_NAME, 5) = '_T112'
GROUP BY TABLE_TYPE
ORDER BY TABLE_TYPE;| TABLE_TYPE | HOW_MANY |
|---|---|
| BASE TABLE | 2 |
| VIEW | 1 |
Counted by kind, it is two base tables and one view.
Look at the last column of the catalog grid as well. PAYMENTS_T112 has no comment and the catalog reports a real NULL, where the SHOW grid above reported an empty string. Same table, same missing comment, two different answers. If you ever write something that tests a comment for IS NULL, it matters which of these two you read it from.
And the view's ROW_COUNT is NULL too, because a view holds nothing to count.
These two look interchangeable and they are not. One includes views and one does not, and nothing warns you. If you are counting objects, say which of them you counted.
Let's DESCRIBE the table
DESCRIBE answers the other question: not what objects are there, but what is inside one of them.
DESCRIBE TABLE INVOICES_T112;| name | type | kind | null? | default | primary key | unique key | check | expression | comment | policy name | privacy domain | write default |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| INVOICE_ID | NUMBER(38,0) | COLUMN | Y | NULL | N | N | NULL | NULL | the invoice number, not gapless | NULL | NULL | NULL |
| CUSTOMER | VARCHAR(40) | COLUMN | Y | NULL | N | N | NULL | NULL | who it is for | NULL | NULL | NULL |
| AMOUNT | NUMBER(10,2) | COLUMN | Y | NULL | N | N | NULL | NULL | gross, in account currency | NULL | NULL | NULL |
| ISSUED | DATE | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | NULL | NULL | NULL |
Four rows, one per column, and a very wide grid to say it in. name, type, kind, null? and default are the useful ones. Then primary key, unique key, check, expression, comment, policy name, privacy domain and write default.
Most of those are NULL here, which is normal. And the comment column shows the three comments we wrote, with a NULL against ISSUED.
The same RESULT_SCAN trick works on it, because it is just another query's output.
SELECT "name", "type", "null?", "default", "comment"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
ORDER BY "name";| name | type | null? | default | comment |
|---|---|---|---|---|
| AMOUNT | NUMBER(10,2) | Y | NULL | gross, in account currency |
| CUSTOMER | VARCHAR(40) | Y | NULL | who it is for |
| INVOICE_ID | NUMBER(38,0) | Y | NULL | the invoice number, not gapless |
| ISSUED | DATE | Y | NULL | NULL |
Five columns instead of thirteen, and sorted by name, which DESCRIBE on its own will not do for you.
DESC is the same command spelled shorter.
DESC TABLE INVOICES_T112;| name | type | kind | null? | default | primary key | unique key | check | expression | comment | policy name | privacy domain | write default |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| INVOICE_ID | NUMBER(38,0) | COLUMN | Y | NULL | N | N | NULL | NULL | the invoice number, not gapless | NULL | NULL | NULL |
| CUSTOMER | VARCHAR(40) | COLUMN | Y | NULL | N | N | NULL | NULL | who it is for | NULL | NULL | NULL |
| AMOUNT | NUMBER(10,2) | COLUMN | Y | NULL | N | N | NULL | NULL | gross, in account currency | NULL | NULL | NULL |
| ISSUED | DATE | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | NULL | NULL | NULL |
Identical output. Use whichever one you can type faster.
Does DESCRIBE VIEW work on a table?
First, the ordinary use. DESCRIBE VIEW on the view.
DESCRIBE VIEW BIG_INVOICES_T112;| name | type | kind | null? | default | primary key | unique key | check | expression | comment | policy name | privacy domain | write default |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| INVOICE_ID | NUMBER(38,0) | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | NULL | NULL | NULL |
| CUSTOMER | VARCHAR(40) | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | NULL | NULL | NULL |
| AMOUNT | NUMBER(10,2) | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | NULL | NULL | NULL |
Three rows, because the view selects three columns. No comments on them, because a view does not inherit the comments of the table underneath it.
Now something I did not know. Let's point DESCRIBE VIEW at the table.
DESCRIBE VIEW INVOICES_T112;| name | type | kind | null? | default | primary key | unique key | check | expression | comment | policy name | privacy domain | write default |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| INVOICE_ID | NUMBER(38,0) | COLUMN | Y | NULL | N | N | NULL | NULL | the invoice number, not gapless | NULL | NULL | NULL |
| CUSTOMER | VARCHAR(40) | COLUMN | Y | NULL | N | N | NULL | NULL | who it is for | NULL | NULL | NULL |
| AMOUNT | NUMBER(10,2) | COLUMN | Y | NULL | N | N | NULL | NULL | gross, in account currency | NULL | NULL | NULL |
| ISSUED | DATE | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | NULL | NULL | NULL |
It works. Four rows, comments and all, exactly as DESCRIBE TABLE gave us. The two keywords are interchangeable here.
What is not interchangeable is the name of something that does not exist.
DESCRIBE TABLE NO_SUCH_TABLE_T112;002003 (42S02): SQL compilation error: Table 'NO_SUCH_TABLE_T112' does not exist or not authorized. Your primary role ACCOUNTADMIN or one of your secondary roles must have at least one privilege granted on TABLE NO_SUCH_TABLE_T112.
does not exist or not authorized, which is the same message you get for a table you have no privilege on. Snowflake will not tell you which of the two it is.
Now the one worth the episode: DESCRIBE RESULT
DESCRIBE works on a stored object. It also works on a result, which means you can ask what types a query produced without building a table out of it.
Let's run a query with an expression in it. AMOUNT is declared as NUMBER(10,2), and we are going to multiply it.
SELECT INVOICE_ID,
CUSTOMER,
AMOUNT * 1.2 AS WITH_TAX,
DATE_TRUNC('MONTH', ISSUED) AS MONTH_ISSUED
FROM INVOICES_T112
ORDER BY INVOICE_ID;| INVOICE_ID | CUSTOMER | WITH_TAX | MONTH_ISSUED |
|---|---|---|---|
| 1001 | Ana Ltd | 144.000 | 2026-01-01 |
| 1002 | Ben GmbH | 408.600 | 2026-02-01 |
| 1003 | Cleo SA | 90.300 | 2026-02-01 |
Sensible numbers. Now let's ask what the types of those four columns are.
DESCRIBE RESULT LAST_QUERY_ID();| name | type | kind | null? | default | primary key | unique key | check | expression | comment | policy name | privacy domain | write default |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| INVOICE_ID | NUMBER(38,0) | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | NULL | NULL | NULL |
| CUSTOMER | VARCHAR(40) | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | NULL | NULL | NULL |
| WITH_TAX | NUMBER(12,3) | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | NULL | NULL | NULL |
| MONTH_ISSUED | DATE | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | NULL | NULL | NULL |
INVOICE_ID and CUSTOMER came straight from the table and kept their types. MONTH_ISSUED is a DATE.
And WITH_TAX is NUMBER(12,3). We started from NUMBER(10,2) and multiplied by 1.2, and Snowflake decided the result needed two more digits of precision and one more of scale.
That decision is written nowhere in the query. DESCRIBE RESULT is how you see it, and it is the thing to reach for before you create a table from a SELECT and wonder why the column came out wider than the one it came from.
And because it is a result like any other, it scans too.
SELECT "name", "type"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));| name | type |
|---|---|
| INVOICE_ID | NUMBER(38,0) |
| CUSTOMER | VARCHAR(40) |
| WITH_TAX | NUMBER(12,3) |
| MONTH_ISSUED | DATE |
So where do comments actually live?
In more than one place, and they do not all answer the same way. Let's run the DESCRIBE again and pull just the comments out of it.
DESCRIBE TABLE INVOICES_T112;| name | type | kind | null? | default | primary key | unique key | check | expression | comment | policy name | privacy domain | write default |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| INVOICE_ID | NUMBER(38,0) | COLUMN | Y | NULL | N | N | NULL | NULL | the invoice number, not gapless | NULL | NULL | NULL |
| CUSTOMER | VARCHAR(40) | COLUMN | Y | NULL | N | N | NULL | NULL | who it is for | NULL | NULL | NULL |
| AMOUNT | NUMBER(10,2) | COLUMN | Y | NULL | N | N | NULL | NULL | gross, in account currency | NULL | NULL | NULL |
| ISSUED | DATE | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | NULL | NULL | NULL |
SELECT "name", "comment"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
ORDER BY "name";| name | comment |
|---|---|
| AMOUNT | gross, in account currency |
| CUSTOMER | who it is for |
| INVOICE_ID | the invoice number, not gapless |
| ISSUED | NULL |
Three columns have a comment. ISSUED has a NULL, because we never gave it one.
The catalog agrees.
SELECT COLUMN_NAME, COMMENT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'PUBLIC' AND TABLE_NAME = 'INVOICES_T112'
ORDER BY ORDINAL_POSITION;| COLUMN_NAME | COMMENT |
|---|---|
| INVOICE_ID | the invoice number, not gapless |
| CUSTOMER | who it is for |
| AMOUNT | gross, in account currency |
| ISSUED | NULL |
The same four columns, the same three comments, the same NULL. This one comes back in the table's own column order rather than alphabetically.
And the stored definition carries them as well.
SELECT GET_DDL('TABLE', 'INVOICES_T112') AS THE_DDL;| THE_DDL |
|---|
| create or replace TABLE INVOICES_T112 ( INVOICE_ID NUMBER(38,0) COMMENT 'the invoice number, not gapless', CUSTOMER VARCHAR(40) COMMENT 'who it is for', AMOUNT NUMBER(10,2) COMMENT 'gross, in account currency', ISSUED DATE )COMMENT='episode 112 probe table' ; |
GET_DDL writes each comment back into the column that owns it, and the table's own comment onto the end. If you are copying a table definition somewhere else, this is the version that takes the comments with it.
Let's add a comment after the fact
A comment is not something you have to decide at create time. COMMENT ON COLUMN sets one on a column that already exists.
COMMENT ON COLUMN INVOICES_T112.ISSUED IS 'the date on the paper, not the date we entered it';| status |
|---|
| Statement executed successfully. |
SELECT COLUMN_NAME, COMMENT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'PUBLIC' AND TABLE_NAME = 'INVOICES_T112'
ORDER BY ORDINAL_POSITION;| COLUMN_NAME | COMMENT |
|---|---|
| INVOICE_ID | the invoice number, not gapless |
| CUSTOMER | who it is for |
| AMOUNT | gross, in account currency |
| ISSUED | the date on the paper, not the date we entered it |
Every column has one now. Nothing about the column itself changed, only the description of it.
The table's own comment can be changed the same way.
COMMENT ON TABLE INVOICES_T112 IS 'episode 112 probe table - comment changed after the fact';| status |
|---|
| Statement executed successfully. |
SELECT TABLE_NAME, COMMENT
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'PUBLIC' AND TABLE_NAME = 'INVOICES_T112';| TABLE_NAME | COMMENT |
|---|---|
| INVOICES_T112 | episode 112 probe table - comment changed after the fact |
Replaced, not appended. COMMENT ON always sets the whole thing.
Does a comment survive a change to the column?
This is the question that matters if you are relying on comments as documentation. Let's widen the amount column and see what happens to the comment on it.
ALTER TABLE INVOICES_T112 ALTER COLUMN AMOUNT SET DATA TYPE NUMBER(12,2);| status |
|---|
| Statement executed successfully. |
SELECT COLUMN_NAME, DATA_TYPE, NUMERIC_PRECISION, COMMENT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'PUBLIC' AND TABLE_NAME = 'INVOICES_T112'
AND COLUMN_NAME = 'AMOUNT';| COLUMN_NAME | DATA_TYPE | NUMERIC_PRECISION | COMMENT |
|---|---|---|---|
| AMOUNT | NUMBER | 12 | gross, in account currency |
The precision is the new one, and the comment is still there, word for word. It survived.
Now something more drastic. Let's rename the column we gave a comment to a minute ago.
ALTER TABLE INVOICES_T112 RENAME COLUMN ISSUED TO ISSUE_DATE;| status |
|---|
| Statement executed successfully. |
SELECT COLUMN_NAME, COMMENT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'PUBLIC' AND TABLE_NAME = 'INVOICES_T112'
ORDER BY ORDINAL_POSITION;| COLUMN_NAME | COMMENT |
|---|---|
| INVOICE_ID | the invoice number, not gapless |
| CUSTOMER | who it is for |
| AMOUNT | gross, in account currency |
| ISSUE_DATE | the date on the paper, not the date we entered it |
Still there, under the new name. Comments follow the column rather than the name, so neither of those two changes lost anything.
What happens if we set a comment to an empty string?
There is no COMMENT OFF. The way people remove a comment is to set it to nothing, so let's see exactly what that leaves behind.
COMMENT ON COLUMN INVOICES_T112.CUSTOMER IS '';| status |
|---|
| Statement executed successfully. |
SELECT COLUMN_NAME, COMMENT, LENGTH(COMMENT) AS COMMENT_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'PUBLIC' AND TABLE_NAME = 'INVOICES_T112'
AND COLUMN_NAME = 'CUSTOMER';| COLUMN_NAME | COMMENT | COMMENT_LENGTH |
|---|---|---|
| CUSTOMER | 0 |
The comment cell is empty and its length is zero. That is an empty string, not a NULL. The column now has a comment, and the comment is nothing.
Compare it with ISSUED near the top of this post, which had a real NULL because nobody had ever written a comment on it. The two look the same to a person and completely different to a query.
If you are counting undocumented columns with WHERE COMMENT IS NULL, this column will not be in your answer. Test for both: COMMENT IS NULL OR COMMENT = ''.
And SHOW COLUMNS answers in JSON
There is a third way to ask what is in a table, and it replies in a shape nobody expects.
SHOW COLUMNS IN TABLE INVOICES_T112;| table_name | schema_name | column_name | data_type | null? | default | kind | expression | comment | database_name | autoincrement | schema_evolution_record | write_default |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| INVOICES_T112 | PUBLIC | INVOICE_ID | {"type":"FIXED","precision":38,"scale":0,"nullable":true} | true | COLUMN | the invoice number, not gapless | DEMO_DB | NULL | NULL | |||
| INVOICES_T112 | PUBLIC | CUSTOMER | {"type":"TEXT","length":40,"byteLength":160,"nullable":true,"fixed":false} | true | COLUMN | DEMO_DB | NULL | NULL | ||||
| INVOICES_T112 | PUBLIC | AMOUNT | {"type":"FIXED","precision":12,"scale":2,"nullable":true} | true | COLUMN | gross, in account currency | DEMO_DB | NULL | NULL | |||
| INVOICES_T112 | PUBLIC | ISSUE_DATE | {"type":"DATE","nullable":true} | true | COLUMN | the date on the paper, not the date we entered it | DEMO_DB | NULL | NULL |
The comments are all correct, including the empty one we just made. Now look at the data_type column.
SELECT "column_name", "data_type", "comment"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
ORDER BY "column_name";| column_name | data_type | comment |
|---|---|---|
| AMOUNT | {"type":"FIXED","precision":12,"scale":2,"nullable":true} | gross, in account currency |
| CUSTOMER | {"type":"TEXT","length":40,"byteLength":160,"nullable":true,"fixed":false} | |
| INVOICE_ID | {"type":"FIXED","precision":38,"scale":0,"nullable":true} | the invoice number, not gapless |
| ISSUE_DATE | {"type":"DATE","nullable":true} | the date on the paper, not the date we entered it |
That is JSON. AMOUNT comes back as {"type":"FIXED","precision":12,"scale":2,"nullable":true}, with the precision we widened it to. The date column has its own shorter object.
DESCRIBE told us the same fact as a single string, in the form a person writes it in a CREATE TABLE. SHOW COLUMNS tells us as an object, in the form a program would want it. Same fact, two commands, two shapes.
That is worth knowing before you write anything that parses one of them, because the two are not interchangeable and neither one is wrong.
One more: SHOW VIEWS, and what it quietly includes
We have one view in this schema. Let's see what SHOW VIEWS makes of it.
SHOW VIEWS IN SCHEMA PUBLIC;| created_on | name | reserved | database_name | schema_name | owner | comment | text | is_secure | is_materialized | owner_role_type | change_tracking |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-09-28 18:27:18.637000-07:00 | BIG_INVOICES_T112 | DEMO_DB | PUBLIC | ACCOUNTADMIN | invoices over 100 | CREATE OR REPLACE VIEW BIG_INVOICES_T112 comment = 'invoices over 100' AS SELECT INVOICE_ID, CUSTOMER, AMOUNT FROM INVOICES_T112 WHERE AMOUNT > 100 | false | false | ROLE | OFF | |
| 2026-09-28 18:25:34.020000-07:00 | MV_CTE_T109 | DEMO_DB | PUBLIC | ACCOUNTADMIN | CREATE OR REPLACE MATERIALIZED VIEW MV_CTE_T109 AS WITH BIG AS (SELECT ORDER_ID, AMOUNT FROM ORDERS_T109 WHERE AMOUNT > 100) SELECT ORDER_ID, AMOUNT FROM BIG | false | true | ROLE | OFF | ||
| 2026-09-28 18:25:32.825000-07:00 | MV_UNIONED_T109 | DEMO_DB | PUBLIC | ACCOUNTADMIN | CREATE OR REPLACE MATERIALIZED VIEW MV_UNIONED_T109 AS SELECT ORDER_ID, AMOUNT FROM ORDERS_T109 WHERE REGION = 'north' UNION ALL SELECT ORDER_ID, AMOUNT FROM ORDERS_T109 WHERE REGION = 'south' | false | true | ROLE | OFF |
Three rows, and we only made one view. The other two are materialized views, which SHOW VIEWS lists alongside ordinary ones, with is_materialized set to true to tell them apart.
They are left over from Episode 109. That episode predicted Snowflake would refuse to build a materialized view over a UNION ALL and over a WITH clause, and it accepted both, so no DROP was ever written for them. Their definitions are there in the text column if you want to read them.
Filtering down to the one this post made is the same trick as before.
SELECT "name", "comment", "is_secure"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "name" LIKE '%T112';| name | comment | is_secure |
|---|---|---|
| BIG_INVOICES_T112 | invoices over 100 | false |
One row, with its comment and the is_secure flag. The filter is a WHERE clause on the output of a SHOW, which is the thing we could not do at the start of this post.
So which command should you count with?
SHOW TABLES missed the view and the catalog found it. There is a third command that covers both, and it says which is which.
SHOW OBJECTS IN SCHEMA PUBLIC;| created_on | name | database_name | schema_name | kind | comment | cluster_by | rows | bytes | owner | retention_time | owner_role_type | is_hybrid | is_dynamic | is_iceberg | is_interactive |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-09-28 18:27:18.637000-07:00 | BIG_INVOICES_T112 | DEMO_DB | PUBLIC | VIEW | invoices over 100 | 0 | 0 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | |
| 2026-09-28 18:27:08.999000-07:00 | CUSTOMERS | DEMO_DB | PUBLIC | TABLE | 10 | 1536 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:07.395000-07:00 | DEPARTMENTS | DEMO_DB | PUBLIC | TABLE | 4 | 1024 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:15.165000-07:00 | DOCS_XML | DEMO_DB | PUBLIC | TABLE | 4 | 1536 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:08.115000-07:00 | EMPLOYEES | DEMO_DB | PUBLIC | TABLE | 8 | 2048 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:11.646000-07:00 | EVENTS_JSON | DEMO_DB | PUBLIC | TABLE | 4 | 3072 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:17.808000-07:00 | INVOICES_T112 | DEMO_DB | PUBLIC | TABLE | episode 112 probe table - comment changed after the fact | 3 | 1024 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | |
| 2026-09-27 03:50:28.146000-07:00 | JSON_LOADED | DEMO_DB | PUBLIC | TABLE | 11 | 2560 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:14.430000-07:00 | JSON_TEXT_RAW | DEMO_DB | PUBLIC | TABLE | 11 | 1536 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:25:34.020000-07:00 | MV_CTE_T109 | DEMO_DB | PUBLIC | VIEW | 2 | 1024 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:25:32.825000-07:00 | MV_UNIONED_T109 | DEMO_DB | PUBLIC | VIEW | 4 | 1024 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:09.808000-07:00 | ORDERS | DEMO_DB | PUBLIC | TABLE | 41 | 1536 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:18.914000-07:00 | PAYMENTS_T112 | DEMO_DB | PUBLIC | TABLE | 0 | 0 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:10.959000-07:00 | SALES_RAW | DEMO_DB | PUBLIC | TABLE | 8 | 1536 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:16.148000-07:00 | TYPED_SHAPES | DEMO_DB | PUBLIC | TABLE | 2 | 2560 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-27 20:10:07.808000-07:00 | XML_LOADED | DEMO_DB | PUBLIC | TABLE | 4 | 4096 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N |
Everything in the schema, in one list, with a kind column saying what each one is. The flags on the end — is_hybrid, is_dynamic, is_iceberg — name the special kinds of table, which is how you tell a dynamic table from an ordinary one without reading IS_INSERTABLE_INTO.
Have a look at the comment column on the rows that have none. SHOW OBJECTS reports an empty string, the same as SHOW TABLES did.
Now let's count by kind.
SELECT "kind", COUNT(*) AS HOW_MANY
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "name" LIKE '%T112'
GROUP BY "kind"
ORDER BY "kind";| kind | HOW_MANY |
|---|---|
| TABLE | 2 |
| VIEW | 1 |
Two tables and one view, which is the answer the catalog gave us and the answer SHOW TABLES did not.
And since it is a table, we can have the whole summary in one row.
SHOW OBJECTS IN SCHEMA PUBLIC;| created_on | name | database_name | schema_name | kind | comment | cluster_by | rows | bytes | owner | retention_time | owner_role_type | is_hybrid | is_dynamic | is_iceberg | is_interactive |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-09-28 18:27:18.637000-07:00 | BIG_INVOICES_T112 | DEMO_DB | PUBLIC | VIEW | invoices over 100 | 0 | 0 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | |
| 2026-09-28 18:27:08.999000-07:00 | CUSTOMERS | DEMO_DB | PUBLIC | TABLE | 10 | 1536 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:07.395000-07:00 | DEPARTMENTS | DEMO_DB | PUBLIC | TABLE | 4 | 1024 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:15.165000-07:00 | DOCS_XML | DEMO_DB | PUBLIC | TABLE | 4 | 1536 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:08.115000-07:00 | EMPLOYEES | DEMO_DB | PUBLIC | TABLE | 8 | 2048 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:11.646000-07:00 | EVENTS_JSON | DEMO_DB | PUBLIC | TABLE | 4 | 3072 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:17.808000-07:00 | INVOICES_T112 | DEMO_DB | PUBLIC | TABLE | episode 112 probe table - comment changed after the fact | 3 | 1024 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | |
| 2026-09-27 03:50:28.146000-07:00 | JSON_LOADED | DEMO_DB | PUBLIC | TABLE | 11 | 2560 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:14.430000-07:00 | JSON_TEXT_RAW | DEMO_DB | PUBLIC | TABLE | 11 | 1536 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:25:34.020000-07:00 | MV_CTE_T109 | DEMO_DB | PUBLIC | VIEW | 2 | 1024 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:25:32.825000-07:00 | MV_UNIONED_T109 | DEMO_DB | PUBLIC | VIEW | 4 | 1024 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:09.808000-07:00 | ORDERS | DEMO_DB | PUBLIC | TABLE | 41 | 1536 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:18.914000-07:00 | PAYMENTS_T112 | DEMO_DB | PUBLIC | TABLE | 0 | 0 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:10.959000-07:00 | SALES_RAW | DEMO_DB | PUBLIC | TABLE | 8 | 1536 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-28 18:27:16.148000-07:00 | TYPED_SHAPES | DEMO_DB | PUBLIC | TABLE | 2 | 2560 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N | ||
| 2026-09-27 20:10:07.808000-07:00 | XML_LOADED | DEMO_DB | PUBLIC | TABLE | 4 | 4096 | ACCOUNTADMIN | 1 | ROLE | N | N | N | N |
SELECT COUNT(*) AS OBJECTS_FROM_THIS_FILE,
SUM(IFF("kind" = 'TABLE', 1, 0)) AS TABLES,
SUM(IFF("kind" = 'VIEW', 1, 0)) AS VIEWS,
SUM(IFF("comment" IS NULL OR "comment" = '', 1, 0)) AS WITHOUT_A_COMMENT
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
WHERE "name" LIKE '%T112';| OBJECTS_FROM_THIS_FILE | TABLES | VIEWS | WITHOUT_A_COMMENT |
|---|---|---|---|
| 3 | 2 | 1 | 1 |
Objects, tables, views and the number of them with no useful comment, worked out in one statement over the output of a SHOW. The last column counts a NULL and an empty string together on purpose, which after the last two sections is the only honest way to count it.
One last thing: let's tidy up
The view goes first, because it reads from the table.
-- Put the schema back the way we found it.
DROP VIEW IF EXISTS BIG_INVOICES_T112;
DROP TABLE IF EXISTS INVOICES_T112;
DROP TABLE IF EXISTS PAYMENTS_T112;SELECT CURRENT_DATABASE() AS THE_DATABASE,
CURRENT_SCHEMA() AS THE_SCHEMA,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES
WHERE RIGHT(TABLE_NAME, 5) = '_T112') AS PROBE_OBJECTS_LEFT,
(SELECT COUNT(*) FROM CUSTOMERS) AS DEMO_DB_IS_READABLE;| THE_DATABASE | THE_SCHEMA | PROBE_OBJECTS_LEFT | DEMO_DB_IS_READABLE |
|---|---|---|---|
| DEMO_DB | PUBLIC | 0 | 10 |
No probe objects left, and the demo database still reads. Back where we started.
Key points
- A
WHEREclause on aSHOWis a syntax error, and so is selecting from one. Its ownLIKEis the only filter it has. TABLE(RESULT_SCAN(LAST_QUERY_ID()))turns the last query's output into a table, so aSHOWcan be filtered, counted, summed, sorted and joined.SHOWreturns its column names in lower case, so they have to be written in double quotes.SHOW TABLESandINFORMATION_SCHEMA.TABLESdisagree, because the catalog view includes views andSHOW TABLESdoes not.SHOW OBJECTScovers both and has akindcolumn that says which is which.DESCRIBEreturns one row per column and a very wide grid to say it in.DESCis the same command.DESCRIBE VIEWworks on a table. The two keywords are interchangeable there.DESCRIBE RESULT LAST_QUERY_ID()gives the types a query produced, including for expressions you never declared.- A
NUMBER(10,2)multiplied by1.2came back asNUMBER(12,3), which is written nowhere in the query. - A column comment survives a type change and survives a rename. Both held.
- Setting a comment to
''leaves an empty string, not aNULL. Test for both when you count undocumented columns. - A missing comment comes back as an empty string from
SHOWand as aNULLfrom the catalog view. Same fact, two answers. SHOW COLUMNSreports the data type as a JSON object whereDESCRIBEreports it as a string.SHOW VIEWSlists materialized views too, withis_materializedset totrue.
Episode 113 — external tables and Iceberg tables. Both of them want cloud storage, and the account in these posts has none. So instead of describing them we will ask Snowflake, and read the refusals, which turn out to be the clearest definition of either feature you will get.
Every query and every result grid on this page was captured from a live Snowflake account (version 10.34.101) running the demo script for this episode, and the sections are in the order the script ran them, so the grids agree with the text beside them. The _T112 objects are created and dropped by the scripts above. Other objects in the grids belong to earlier posts in this series, including two materialized views Episode 109 left behind, and the text says so where they appear. Empty cells marked empty are empty strings and cells reading NULL are real nulls; the difference is a point this post makes twice. Nothing is timed and no performance claims are made anywhere in this series. RESULT_SCAN follows the Snowflake RESULT_SCAN documentation.



No comments:
Post a Comment
Note: Only a member of this blog may post a comment.