PostgreSQL常用命令

一、常规操作

1、连接数据库

psql -h 127.0.0.1 -p 5432 -U bi_data_admin -d teable -W

2、查询数据内容

select * from "teable"."bseufx"."ai_test" limit 10;

3、查询表结构

select * from information_schema.columns where table_schema='bseufx' and table_name='ai_layering_test';

4、退出

\q

5、查询slot

SELECT * from pg_replication_slots where slot_name = 'daecfacadebf';

6、清理slot(谨慎操作

SELECT pg_drop_replication_slot(slot_name) FROM pg_replication_slots WHERE slot_name = 'daecfacadebf';

7、查询某个schema下有哪些表

SELECT tablename FROM pg_tables WHERE schemaname = 'bsewEAPxNPC1fYE1s7O';

8、查询版本

select version()

 

posted @ 2025-07-01 15:50  Robots2  阅读(16)  评论(0)    收藏  举报