PostgreSQL学习第七篇--psql常用命令
来源:互联网 发布:visio mac版下载 编辑:程序博客网 时间:2024/06/07 19:44
1)\d :显示数据库中有哪些表\d tab_name :查看表的定义查看索引信息:postgres=# \d txx_pkey Index "public.txx_pkey" Column | Type | Definition--------+---------+------------ id | integer | idprimary key, btree, for table "public.txx"\d+ 命令:将会显示比\d命令更详细的信息,除了前面介绍的那些,它还会显示任何与表列相关的注释,以及表中出现的OID。postgres=# \d+ txx Table "public.txx" Column | Type | Modifiers | Storage | Stats target | Description--------+----------------+-----------+----------+--------------+------------- id | integer | not null | plain | | name | character(100) | | extended | |Indexes: "txx_pkey" PRIMARY KEY, btree (id)postgres=# \d txx Table "public.txx" Column | Type | Modifiers--------+----------------+----------- id | integer | not null name | character(100) |Indexes: "txx_pkey" PRIMARY KEY, btree (id)2)PG中无dual表。select 1+1;postgres=# select 1+1; ?column?---------- 2(1 row)3)显示sql执行的时间,可以使用\timing参数postgres=# \timing onTiming is on.postgres=# select * from txx; id | name----+------(0 rows)Time: 0.795 ms4)列出所有的schema\dnpostgres=# \dn List of schemas Name | Owner --------+---------- public | postgres(1 row)5)显示所有的表空间可以使用\db命令postgres=# \db List of tablespaces Name | Owner | Location------------+----------+---------- pg_default | postgres | pg_global | postgres |(2 rows)实际上postgresSQL中的表空间就是对应一个目录,放在这个表空间中的表,就是把表的数据文件放到这个目录下。6)如果想列出数据库中所有的角色或者用户,可以使用\du \dg,这两个命令等价,因为postgresSQL中用户和角色不区分。postgres=# \du List of roles Role name | Attributes | Member of-----------+------------------------------------------------------------+----------- postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}postgres=# \dg List of roles Role name | Attributes | Member of-----------+------------------------------------------------------------+----------- postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}7)指定字符集编译的命令\encoding命令设定gbk \encoding gbk\encoding utf8
0 0
- PostgreSQL学习第七篇--psql常用命令
- postgresql学习--psql命令行常用命令
- postgresql常用命令psql
- 【PostgreSQL-9.6.3】psql常用命令
- PostgreSQL学习第六篇--psql常用连接数据库的方法
- PostgreSQL学习第八篇--psql的使用技巧和注意事项
- PostgreSQL学习笔记---3 psql命令
- Psql 常用命令
- psql常用命令
- PSQL常用命令
- psql常用命令
- psql 常用命令
- psql常用命令
- psql 常用命令
- PostgreSQL学习第五篇--本机psql设置需要/不需要密码
- postgresql命令行(psql)
- 【psql】PostgreSQL常用指令
- PostgreSQL psql 终端命令
- Android多线程ListView加载并缓冲图片
- 51nod 1072 威佐夫游戏
- 基于huffman的文件压缩
- 一步搞定无法审查元素
- centos 7 解决 systemctl dbus bug
- PostgreSQL学习第七篇--psql常用命令
- css中的布局详解
- SpringBoot构建微服务整体了解
- OpenCV 2.4.9在Ubuntu下的配置与安装
- JAVA下各种编码的中英文字节数
- Python与图像处理8
- VC让鼠标指到按钮上变成手型
- GIS 矢量切片(Vector Tile)-地图定制化的时代已经悄悄来临
- Web前端学习【一】