国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

GaussDB查看數(shù)據(jù)庫、表空間、表、schema大小以及常用的數(shù)據(jù)庫元命令

這篇具有很好參考價值的文章主要介紹了GaussDB查看數(shù)據(jù)庫、表空間、表、schema大小以及常用的數(shù)據(jù)庫元命令。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

查看表空間的大小

openGauss=# select pg_size_pretty(pg_tablespace_size('pg_default'));
 pg_size_pretty 
----------------
 102 MB
(1 row)

openGauss=# select pg_size_pretty(pg_tablespace_size('hr_data'));                 
 pg_size_pretty 
----------------
 1286 MB
(1 row)

GaussDB查看數(shù)據(jù)庫、表空間、表、schema大小以及常用的數(shù)據(jù)庫元命令

查看所有數(shù)據(jù)庫的大小

select pg_size_pretty(sum(pg_database_size(oid))) from pg_database;

GaussDB查看數(shù)據(jù)庫、表空間、表、schema大小以及常用的數(shù)據(jù)庫元命令

查看每個數(shù)據(jù)庫的大小

openGauss=#     select datname,pg_size_pretty(pg_database_size(oid)) from pg_database;
  datname  | pg_size_pretty 
-----------+----------------
 template1 | 14 MB
 test_gbk  | 14 MB
 template0 | 14 MB
 test1     | 14 MB
 postgres  | 31 MB
 mm        | 14 MB
 db_hr     | 1286 MB
(7 rows)

GaussDB查看數(shù)據(jù)庫、表空間、表、schema大小以及常用的數(shù)據(jù)庫元命令
元命令\l+可以快速查看

openGauss=# \l+
                                                               List of databases
   Name    |  Owner   | Encoding  | Collate | Ctype |   Access privileges   |  Size   | Tablespace |                Description                 
-----------+----------+-----------+---------+-------+-----------------------+---------+------------+--------------------------------------------
 db_hr     | lily     | GBK       | C       | C     |                       | 1286 MB | hr_data    | 
 mm        | lily     | GBK       | C       | C     |                       | 14 MB   | pg_default | 
 postgres  | rdsAdmin | SQL_ASCII | C       | C     |                       | 31 MB   | pg_default | default administrative connection database
 template0 | rdsAdmin | SQL_ASCII | C       | C     | =c/rdsAdmin          +| 14 MB   | pg_default | default template for new databases
           |          |           |         |       | rdsAdmin=CTc/rdsAdmin |         |            | 
 template1 | rdsAdmin | SQL_ASCII | C       | C     | =c/rdsAdmin          +| 14 MB   | pg_default | unmodifiable empty database
           |          |           |         |       | rdsAdmin=CTc/rdsAdmin |         |            | 
 test1     | rdsAdmin | GBK       | C       | C     | =Tc/rdsAdmin         +| 14 MB   | pg_default | 
           |          |           |         |       | rdsAdmin=CTc/rdsAdmin+|         |            | 
           |          |           |         |       | lily=c/rdsAdmin       |         |            | 
 test_gbk  | test_gbk | GBK       | C       | C     |                       | 14 MB   | pg_default | 
(7 rows)

查看指定數(shù)據(jù)庫的大小

openGauss=# select pg_size_pretty(pg_database_size('db_hr'));   
 pg_size_pretty 
----------------
 1286 MB
(1 row)

查看每個schema的大小

select schemaname,pg_size_pretty(cast(sum(pg_relation_size(schemaname||'.'||tablename))as bigint)) from pg_tables t inner join pg_namespace d on t.schemaname=d.nspname group by schemaname;

GaussDB查看數(shù)據(jù)庫、表空間、表、schema大小以及常用的數(shù)據(jù)庫元命令

SELECT n.nspname as "Schema",pg_size_pretty(sum(pg_relation_size(n.nspname||'.'||c.relname))) as "TotalSize"
FROM pg_catalog.pg_class c
inner JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
where c.relkind in('r','i')
and n.nspname not in ('pg_catalog','pg_toast','cstore','public','dbms_job','sys','dbms_output','dbms_lob','dbms_random','utl_raw','information_schema')
group by n.nspname; 

GaussDB查看數(shù)據(jù)庫、表空間、表、schema大小以及常用的數(shù)據(jù)庫元命令

查看所有表的大小,并以表大小排序

select tableowner,schemaname,tablename,pg_table_size(schemaname||'.'||tablename) as table_size from pg_tables order by table_size desc;

GaussDB查看數(shù)據(jù)庫、表空間、表、schema大小以及常用的數(shù)據(jù)庫元命令
GaussDB查看數(shù)據(jù)庫、表空間、表、schema大小以及常用的數(shù)據(jù)庫元命令

查看指定schema下所有表的大小

select schemaname || '.' || tablename tname, pg_size_pretty(pg_total_relation_size('"' || schemaname || '"."' || tablename || '"')) from pg_tables where schemaname = '模式名' order by pg_total_relation_size('"' || schemaname || '"."' || tablename || '"')  desc ;

GaussDB查看數(shù)據(jù)庫、表空間、表、schema大小以及常用的數(shù)據(jù)庫元命令文章來源地址http://www.zghlxwxcb.cn/news/detail-508767.html

查看單張表的大小

select pg_size_pretty(pg_table_size('表名'));
select tableowner,schemaname,tablename,pg_size_pretty(pg_table_size(schemaname||'.'||tablename)) as table_size from pg_tables where tablename='表名';

查看表的分區(qū)的大小

select pg_size_pretty(pg_partition_size('表名',' 分區(qū)名'));

基本操作命令


                \l  列出所有數(shù)據(jù)庫				
                \d tablename 列出指定表的所有字段
                \d+ tablename 查看指定表的基本情況	
				\d 列出當前數(shù)據(jù)庫下的表				
                \c database_name 切換數(shù)據(jù)庫
                \dn 展示當前數(shù)據(jù)庫下所有schema信息
				\du 列出角色
				\dv 列表視圖
				\di 列表索引
				\q 退出登錄
				gsql -d 數(shù)據(jù)庫名字 -p 端口 -U 用戶名字 -W '密碼'
				cm_ctl query -Cvipd 查詢集群的狀態(tài)
                SHOW search_path; 顯示當前使用的schema
                SET search_path TO myschema; 切換當前schema

到了這里,關(guān)于GaussDB查看數(shù)據(jù)庫、表空間、表、schema大小以及常用的數(shù)據(jù)庫元命令的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權(quán),不承擔相關(guān)法律責任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務器費用

相關(guān)文章

  • [1180]clickhouse查看數(shù)據(jù)庫和表的容量大小

    [1180]clickhouse查看數(shù)據(jù)庫和表的容量大小

    在mysql中information_schema這個數(shù)據(jù)庫中保存了mysql服務器所有數(shù)據(jù)庫的信息, 而在clickhouse,我們可以通過system.parts查看clickhouse數(shù)據(jù)庫和表的容量大小、行數(shù)、壓縮率以及分區(qū)信息。 在此通過測試數(shù)據(jù)庫來說明。 結(jié)果為:這種結(jié)果顯示的大小size是字節(jié),我們?nèi)绾无D(zhuǎn)換為常見的

    2024年02月05日
    瀏覽(31)
  • 系列十三、查詢數(shù)據(jù)庫中某個庫、表、索引等所占空間的大小

    系列十三、查詢數(shù)據(jù)庫中某個庫、表、索引等所占空間的大小

    ????????information_schema數(shù)據(jù)庫是MySQL出廠默認帶的一個數(shù)據(jù)庫,不管我們是在Linux中安裝MySQL還是在Windows中安裝MySQL,安裝好后都會有一個數(shù)據(jù)庫information_schema,這個庫中存放了其他庫的所有信息。 schemata表: 這個表里面主要是存儲在mysql中的所有的數(shù)據(jù)庫的信息。 tables表

    2024年02月01日
    瀏覽(23)
  • 【postgresql 基礎(chǔ)入門】基礎(chǔ)架構(gòu)和命名空間層次,查看數(shù)據(jù)庫對象再也不迷路

    ? 專欄內(nèi)容 : postgresql內(nèi)核源碼分析 手寫數(shù)據(jù)庫toadb 并發(fā)編程 ? 開源貢獻 : toadb開源庫 個人主頁 :我的主頁 管理社區(qū) :開源數(shù)據(jù)庫 座右銘:天行健,君子以自強不息;地勢坤,君子以厚德載物. 入門準備 postgrersql基礎(chǔ)架構(gòu) 快速使用 初始化集群 數(shù)據(jù)庫服務管理 psql客戶

    2024年02月09日
    瀏覽(50)
  • DBeaver連接華為高斯數(shù)據(jù)庫 DBeaver連接Gaussdb數(shù)據(jù)庫 DBeaver connect Gaussdb

    DBeaver連接華為高斯數(shù)據(jù)庫 DBeaver連接Gaussdb數(shù)據(jù)庫 DBeaver connect Gaussdb

    ? ????????華為GaussDB出來已經(jīng)有一段時間,最近工作中剛到Gauss數(shù)據(jù)庫。作為coder,那么如何通過可視化工具來操作Gauss呢? 本文將記錄使用 免費、開源的DBeaver 來連接Gauss 高斯數(shù)據(jù)庫。 ????????1、安裝Gauss數(shù)據(jù)庫 ????????已經(jīng)安裝好的Gauss數(shù)據(jù)庫服務。參考地址:

    2024年02月16日
    瀏覽(22)
  • 數(shù)據(jù)庫模式(schema)是什么?

    數(shù)據(jù)庫模式(schema)是什么?

    在數(shù)據(jù)庫的術(shù)語中,模式(schema)是一個邏輯概念,用于組織數(shù)據(jù)庫中的對象。模式中的對象通常包括表、索引、數(shù)據(jù)類型、序列、視圖、存儲過程、主鍵、外鍵等等。 模式可以為數(shù)據(jù)庫對象提供邏輯隔離功能,不用應用程序可以使用各自的模式,實現(xiàn)安全的訪問權(quán)限控制。

    2024年02月06日
    瀏覽(25)
  • 【GaussDB數(shù)據(jù)庫】序

    【GaussDB數(shù)據(jù)庫】序

    參考鏈接1:國產(chǎn)數(shù)據(jù)庫華為高斯數(shù)據(jù)庫(GaussDB)功能與特點總結(jié) 參考鏈接2:GaussDB(DWS)介紹 官方網(wǎng)站:云數(shù)據(jù)庫GaussDB GaussDB是華為自主創(chuàng)新研發(fā)的分布式關(guān)系型數(shù)據(jù)庫。該產(chǎn)品支持分布式事務,同城跨AZ部署,數(shù)據(jù)0丟失,支持1000+的擴展能力,PB級海量存儲。 同時擁有云上高

    2024年01月18日
    瀏覽(24)
  • 如何安全地變更數(shù)據(jù)庫 Schema

    如何安全地變更數(shù)據(jù)庫 Schema

    最近 Reddit 的 r/golang 下有人問了一個如何做數(shù)據(jù)庫 schema 變更的問題,不到一天,就有了超過 40 條回復。 數(shù)據(jù)庫 schema 變更一直是讓程序員頭疼的問題,但又不得不面對,畢竟業(yè)務要發(fā)展,產(chǎn)品要迭代,添加新的功能往往需要去修改數(shù)據(jù)庫的結(jié)構(gòu),比如添加一個新的字段來保

    2024年02月10日
    瀏覽(13)
  • GaussDB數(shù)據(jù)庫事務介紹

    GaussDB數(shù)據(jù)庫事務介紹

    目錄 一、前言 二、GaussDB事務的定義及應用場景 三、GaussDB事務的管理 四、GaussDB事務語句 五、GaussDB事務隔離 六、GaussDB事務監(jiān)控 七、總結(jié) 隨著大數(shù)據(jù)和互聯(lián)網(wǎng)技術(shù)的不斷發(fā)展,數(shù)據(jù)庫管理系統(tǒng)的作用越來越重要,實現(xiàn)數(shù)據(jù)的快速讀寫以及保證數(shù)據(jù)的安全性和完整性成為企業(yè)

    2023年04月26日
    瀏覽(28)
  • 【PostgreSQL】連接pg數(shù)據(jù)庫Schema切換

    【PostgreSQL】連接pg數(shù)據(jù)庫Schema切換

    由于PostgreSQL數(shù)據(jù)庫模式(schema)存在多個,原先的表單是默認采用public但是查詢表和字段時候有查詢所有未進行過濾,導致數(shù)據(jù)庫連接失敗、查表字段也為空(空即查詢服務端異常錯誤) 數(shù)據(jù)庫連接配置 添加參數(shù)補充 ?currentSchema=dwd 譬如: username=root;password=XXXX;url=jdbc:postg

    2024年02月11日
    瀏覽(28)
  • 再識華為云數(shù)據(jù)庫——GaussDB

    再識華為云數(shù)據(jù)庫——GaussDB

    目錄 一、GaussDB: 立足創(chuàng)新與自研,助力企業(yè)核心數(shù)據(jù)安全高效上云 二、GaussDB: 基于華為openGauss開放生態(tài)打造的 金融級分布式數(shù)據(jù)庫 三、GaussDB(for MySQL): 基于開源生態(tài)打造的企業(yè)級自研云原生數(shù)據(jù)庫 四、DRS+UGO:數(shù)據(jù)庫結(jié)構(gòu)+應用+數(shù)據(jù)一站式遷移... 5 五、GaussDB NoSQL:國內(nèi)首家,

    2024年02月01日
    瀏覽(21)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包