简体   繁体   English

使用SQLWorkbench在redshift中列出表

[英]list tables in redshift using SQLWorkbench

How do I list tables in redshift ? 如何在redshift中列出表格?

I am using SQLWorkbench. 我正在使用SQLWorkbench。

I tried SHOW TABLES; 我试过SHOW TABLES; and \\dt are not recognized commands. \\dt是无法识别的命令。

Any help? 有帮助吗?

On Sql workbench, 在Sql工作台上,

Go to Tools -> New DBexplorerWindow 转到工具 - >新建DBexplorerWindow

it will load all the tables and click on table name shown the table schema as well 它将加载所有表,并单击显示表模式的表名

Hope this is helpfull. 希望这是有帮助的。

You can use this query to get the list of tables 您可以使用此查询来获取表的列表

SELECT DISTINCT tablename
FROM pg_table_def
WHERE schemaname = 'public'
ORDER BY tablename;

More info here - http://docs.aws.amazon.com/redshift/latest/dg/c_join_PG_examples.html 更多信息 - http://docs.aws.amazon.com/redshift/latest/dg/c_join_PG_examples.html

This should work. 这应该工作。

select datname, nspname, relname, sum(rows) as rows
from pg_class, pg_namespace, pg_database, stv_tbl_perm
where pg_namespace.oid = relnamespace
and pg_class.oid = stv_tbl_perm.id
and pg_database.oid = stv_tbl_perm.db_id
and datname = '**db_name**' and nspname = '**schema_name**'
group by datname, nspname, relname
order by datname, nspname, relname;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM