View 表的 Snowflake Information Schema 行为

Snowflake Information Schema behavior for View tables

我是雪花新手。我正在雪花中创建一个视图,如下所示

create view TABLENAME_VIEW as select * from test.stage.TABLENAME;

虽然 运行 select 关于 information_schema.tables 的声明,但我在执行 select 时将视图 table 的 row_count 设为空视图 tables 上的 count(*) 给出计数。

有人可以帮忙吗。

TABLE_NAME ROW_COUNT TABLE_CATALOG TABLE_TYPE
TABLENAME 5 TEST BASE TABLE
TABLENAME_VIEW NULL TEST VIEW
select count(*) from TABLENAME_VIEW;
COUNT(*)
5

视图不是表(除非它是实体化视图)。所以他们没有行。当您从视图中 select 时,它成为基础 table/s

的投影

这可以通过创建另一个具有“WHERE false”的视图来看出,因此 will return 0 to you select count(*) from the will return 0,但是它不会有行。或者,如果您的视图有“限制 1”。它将计数为 1,但哪个是魔法部分。