View a markdown version of this page

使用 SHOW 命令 - Amazon Redshift

Amazon Redshift 將不再支援從修補程式 198 開始建立新的 Python UDFs。現有 Python UDF 將繼續正常運作至 2026 年 6 月 30 日。如需詳細資訊,請參閱部落格文章

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用 SHOW 命令

如果驅動程式中繼資料 API 未涵蓋您的使用案例,您可以使用 Amazon Redshift SHOW命令來擷取中繼資料。 SHOW命令已針對快速中繼資料擷取進行最佳化。當您在互動式 SQL 工作階段中需要中繼資料,或您的應用程式透過不會公開驅動程式中繼資料 API 的用戶端連線時,它們很有用。

常見探索操作支援下列SHOW命令:

範例

SHOW SCHEMAS FROM DATABASE dev; database_name | schema_name | schema_owner | schema_type | schema_acl | source_database | schema_option ---------------+----------------------+--------------+-------------+-----------------------------+-----------------+--------------- dev | pg_automv | 1 | local | | | dev | pg_catalog | 1 | local | jpuser=UC/jpuser~=U/jpuser | | dev | public | 1 | local | jpuser=UC/jpuser~=UC/jpuser | | dev | information_schema | 1 | local | jpuser=UC/jpuser~=U/jpuser | | dev | schemad79cd6d93bf043 | 1 | local | | |
SHOW TABLES FROM SCHEMA dev.s1 LIKE '%view' LIMIT 1; database_name | schema_name | table_name | table_type | table_acl | remarks | owner | last_altered_time | last_modified_time | dist_style | table_subtype ---------------+-------------+-------------------+------------+--------------------------------------+---------+-------+-------------------+--------------------+------------+------------------- dev | s1 | late_binding_view | VIEW | {alice=arwdRxtDPA/alice,bob=d/alice} | | alice | | | | LATE BINDING VIEW
SHOW COLUMNS FROM TABLE second_db.public.t22; database_name | schema_name | table_name | column_name | ordinal_position | column_default | is_nullable | data_type | character_maximum_length | numeric_precision | numeric_scale | remarks | sort_key_type | sort_key | dist_key | encoding | collation ---------------+-------------+------------+-------------+------------------+----------------+-------------+-----------------------------+--------------------------+-------------------+---------------+---------+---------------+----------+----------+----------+----------- second_db | public | t22 | col1 | 1 | | YES | integer | | 32 | 0 | | INTERLEAVED | -1 | | mostly8 | second_db | public | t22 | col2 | 2 | | YES | character varying | 100 | | | | INTERLEAVED | 2 | | text255 | default second_db | public | t22 | col3 | 3 | | YES | timestamp without time zone | | | | | | 0 | | raw | second_db | public | t22 | col4 | 4 | | YES | numeric | | 10 | 2 | | | 0 | | az64 |

如需詳細資訊,請參閱《Amazon Redshift 資料庫開發人員指南》中的 SHOW