在PostgreSQL中,information_schema包含了许多用于查询数据库元数据的表和视图。一些常见的表和视图包括: tables - 包含数据库中所有表的信息,如表名、表空间、所有者等。 columns - 包含数据库中所有表的列信息,如列名、数据类型、默认值等。 views - 包含数据库中所有视图的信息,如视图名、视图定义等。 constrain...
查询所有表: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'; 复制代码 查询表的列名和数据类型: SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'table_name'; 复制代码 查询表的主键: SELECT column_name FROM information_schema.key...
FROM information_schema.tables ) AS Tables ORDER BY4DESC 11.检查表大小以及依赖项大小 SELECT schemaname, relname as "Table", pg_size_pretty(pg_total_relation_size(relid)) As " table_Size", pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as "External Size" FROM ...
table_comment tableComment, create_time createTimeFROMinformation_schema.TABLESWHEREtable_schema=(SELECTDATABASE ( ) )ANDtable_nameLIKE'%%'ORDERBYcreate_timeDESC showtables PostgreSQL查询: SELECT*FROMinformation_schema.TABLESWHEREtable_schema='public'ANDtable_nameLIKE'%%' SELECTn.nspname, relnameFROMpg...
information_schema.tables ,相当于Oracle中的all_tables 字段信息: information_schema.columns,相当于Oracle中的all_tab_cloumns procedure/function: routines, 不包括package,因为pg不支持package 约束信息: information_schema.table_constraints。另外在constraint_column_usage视图中有约束相关的字段信息;在referential_con...
FROM information_schema.tables WHERE table_schema = 'public'; ``` 这个命令将输出 public schema 中的所有表的名称和类型。你可以根据需要使用 information_schema 中的其他系统表来获取相关的元数据信息。 通过这个流程,你可以在 K8S 环境中轻松地使用 PostgreSQL 的 information_schema 来查询数据库元数据信息,...
postgresql的show databases、show tables、describe table操作 1、相当与mysql的show databases; select datname from pg_database; 2、相当于mysql的show tables; SELECT table_name FROM information_schema.ta…
FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND table_schema NOT IN ('pg_catalog', 'information_schema'); 2 查看用户建立的VIEW SELECT table_name FROM information_schema.views WHERE table_schema NOT IN ('pg_catalog', 'information_schema') ...
在PostgreSQL中,可以通过查询系统表来获取表的架构细节。以下是查询表架构细节的步骤: 首先,连接到PostgreSQL数据库。 使用以下查询语句获取表的架构细节: 代码语言:sql 复制 SELECT column_name, data_type, character_maximum_length, is_nullable FROM information_schema.columns WHERE table_name = 'your_table_nam...
2.information_schema 系统表的替代视图 PG 16 有66个,具体可以参见官方网站:https://www.postgresql....