溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

postgresql10 一些常用的查詢

發(fā)布時(shí)間:2020-08-06 17:36:26 來(lái)源:ITPUB博客 閱讀:144 作者:hgs19921112 欄目:關(guān)系型數(shù)據(jù)庫(kù)
  1. 查詢索引的有效性

    select d.tablename,a.relname,(case c.indisvalid when true then '有效' else '無(wú)效' end) isvalid ,c.indkey from pg_class a ,pg_namespace b ,pg_index c ,pg_indexes d  where a.relkind = 'i' and a.relname=b.oid and b.nspname='public' and a.oid = c.indexrelid and d.indexname=a.relname order by d.tablename;

  2. 表查詢

    select * from pg_table where schemaname = 'xxx';

  3. 查詢索引或者表的大小

    select pg_size_pretty(pg_relaion_size('test'));

  4. 統(tǒng)計(jì)表的行數(shù)

    select a.relname,a.reltuples::int from pg_class a ,pg_namespace b where a.relnamespace=b.oid and b.nspname='public' and a.relkind='r' order by a.relname;

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI