小编给大家分享一下postgresql查数据库信息的方法,相信大部分人都还不怎么了解,因此分享这边文章给大家学习,希望大家阅读完这篇文章后大所收获,下面让我们一起去学习方法吧!

使用下面的命令查看当前使用的数据库:

selectcurrent_database();

postgresql查看数据库大小的方法:

playboy=>\l//\加上字母l,相当于mysql的,mysql>showdatabases;ListofdatabasesName|Owner|Encoding-----------+----------+----------playboy|postgres|UTF8postgres|postgres|UTF8template0|postgres|UTF8template1|postgres|UTF8playboy=>selectpg_database_size('playboy');//查看playboy数据库的大小pg_database_size------------------3637896(1row)playboy=>selectpg_database.datname,pg_database_size(pg_database.datname)ASsizefrompg_database;//查看所有数据库的大小datname|size-----------+---------postgres|3621512playboy|3637896template1|3563524template0|3563524(4rows)playboy=>selectpg_size_pretty(pg_database_size('playboy'));//以KB,MB,GB的方式来查看数据库大小pg_size_pretty----------------3553kB(1row)

以上是postgresql查数据库信息的方法的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!