**:
檢視各個表所占用記憶體
select table_schema || 『.』 || table_name as table_full_name, pg_size_pretty(pg_total_relation_size(『」』 || table_schema || 『」.」』 || table_name || 『」』)) as
size
from information_schema.tables
order
by pg_total_relation_size(『」』 || table_schema || 『」.」』 || table_name || 『」』) desc limit 20;
重置序列
select setval(『scm_inout_daily_acount_id_seq』, max(id)) from scm_inout_daily_acount;
檢視當前序列
select nextval(『scm_inout_daily_acount_id_seq』);
select currval(『scm_inout_daily_acount_id_seq』);
檢視所有表的索引的使用情況
select
relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
from pg_stat_user_indexes
order
by idx_scan asc, idx_tup_read asc, idx_tup_fetch asc;
檢視某個表的索引使用情況
select
relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
from pg_stat_user_indexes
where relname = table_name
order
by idx_scan asc, idx_tup_read asc, idx_tup_fetch asc;
表的大小和表中索引個數
select
t.tablename,
indexname,
c.reltuples as num_rows,
pg_size_pretty(pg_relation_size(quote_ident(t.tablename)::text)) as table_size,
pg_size_pretty(pg_relation_size(quote_ident(indexrelname)::text)) as index_size,
case
when indisunique then 『y』
else 『n』
endas
unique,
idx_scan as number_of_scans,
idx_tup_read as tuples_read,
idx_tup_fetch as tuples_fetched
from pg_tables t
left
outer
join pg_class c on t.tablename=c.relname
left
outer
join
( select c.relname as ctablename, ipg.relname as indexname, x.indnatts as number_of_columns, idx_scan, idx_tup_read, idx_tup_fetch, indexrelname, indisunique from pg_index x
join pg_class c on c.oid = x.indrelid
join pg_class ipg on ipg.oid = x.indexrelid
join pg_stat_all_indexes psai on x.indexrelid = psai.indexrelid )
as foo
on t.tablename = foo.ctablename
where t.schemaname=』public』
order
by1,2;
獲取每個表的行數,索引和一些關於這些索引的資訊(比較詳細)
select
pg_class.relname,
pg_size_pretty(pg_class.reltuples::bigint) as rows_in_bytes,
pg_class.reltuples as num_rows,
count(indexname) as number_of_indexes,
case
when x.is_unique = 1
then 『y』
else 『n』
endas
unique,
sum(case
when number_of_columns = 1
then
1else
0end) as single_column,
sum(case
when number_of_columns is
null
then
0when number_of_columns = 1
then
0else
1end) as multi_column
from pg_namespace
left
outer
join pg_class on pg_namespace.oid = pg_class.relnamespace
left
outer
join
(select indrelid,
max(cast(indisunique as
integer)) as is_unique
from pg_index
group
by indrelid) x
on pg_class.oid = x.indrelid
left
outer
join
( select c.relname as ctablename, ipg.relname as indexname, x.indnatts as number_of_columns from pg_index x
join pg_class c on c.oid = x.indrelid
join pg_class ipg on ipg.oid = x.indexrelid )
as foo
on pg_class.relname = foo.ctablename
where
pg_namespace.nspname=』public』
and pg_class.relkind = 『r』
group
by pg_class.relname, pg_class.reltuples, x.is_unique
order
by2;
匯出表結構:-s -t
pg_dump -s -t ***x.tbtest testdb > tbnode.out
匯出表結構和內容:-t
pg_dump -h mdw -t ***x.tbtest testdb > tbnode.sql
只匯出某個表的內容:-a
pg_dump -h mdw -t ***x.tbtest -a testdb > tbnode.sql
匯入
psql -u postgres testdb < tbnode.out
通用功能點
1.介面 1 列表的更新 新增 刪除 排序等操作 各種操作後的選擇行 2 windows選單操作 3 功能介面常用的功能點 增 刪 改 列表查詢 詳細查詢 重新整理 4 介面顯示的元素通過資料庫獲得,如按鈕名稱 2.功能 1 系統的使用 1 使用者 2 許可權 3 登陸 4 系統設定 a.基礎資料維...
CUDA功能和通用功能
cuda功能和通用功能 本文描述了類似於cuda ufunc的物件。為了支援cuda程式的程式設計模式,cuda vectorize和guvectorize無法產生常規的ufunc。而是返回類似ufunc的物件。該物件是乙個近似的物件,但與常規的numpy ufunc不完全相容。cuda ufunc...
Web Essentials之通用功能
返回web essentials功能目錄 通用功能應用於很多方面。設定所有的設定都可以在vs選擇工具 選項 web essentials中找到 解決方案作用域設定 設定可以是全域性的或者針對某些特定的解決方案。通過單獨解決方案作用域設定,你可以確保所有的團隊成員都在使用相同的設定。要開啟解決方案的設...