1.sql複製原表資料結構
create table au.test1 as select * from au.config where 1=2;
2.在複製的新錶中的某列插入原始資料
insert into au.test 1(uuid) select uuid from au.config;
3.將其它列資料複製到新錶中
update au.test1 a set (name) = (select name from config where uuid = a.uuid);
4.將表擁有者賦予c:alter table a.a_text owner to c;
5.查詢db資料庫所佔記憶體大小:select pg_size_pretty(pg_database_size('db'));
6.查詢test表所佔記憶體大小:select pg_size_pretty(pg_relation_size('test'));
7.查詢資料庫中所有表所佔記憶體大小:
select
schemaname || '.' || tablename as table_full_name,
pg_size_pretty(pg_total_relation_size('"' || schemaname || '"."' || tablename || '"')) as size
from pg_tables
order by
pg_total_relation_size('"' || schemaname || '"."' || tablename || '"') desc
8.pgxl建立表兩種模式:複製模式和分片模式。
create table table_name(...)
distribute by
hash(col)|modulo(col)|roundrobin|replication
to node(nodename1,nodename2...)
sql語句編寫集錦 pgsql
1 查詢活動次數 1 活動次數查詢 select from select province,year,act num act people from bdd tmp ci order by year desc limit 5 as a1 order by act num desc 2 活動人數的查詢...
SQL語句收集
use tablename 要操作的資料庫名 select logicalfilename tablename log 日誌檔名 maxminutes 10,limit on time allowed to wrap log.newsize 1 你想設定的日誌檔案的大小 m setup initia...
MySQL語句收集
1 查詢列名 第乙個引數為資料庫名,第二個引數為表名 select column name from information schema.columns where table schema test and table name tb grade 2 顯示表結構 desc information...