GP資料庫中的表

2021-07-09 09:03:14 字數 1717 閱讀 2254

列重新命名alter table table_name rename column old_column_name to new_column_name;

表重新命名alter table table_name rename to new_table_name;

新增新的列alter table table_name add column column_name column_type

或alter table table_name add column column_name column_type not null default 10;

刪除依賴於被依賴欄位alter table table_name drop column column_name restrict【預設方式】|cascade;

修改字段資料型別alter table table_name alter column column_name integer【或其它型別】;

修改字段預設值alter table table_name alter column column_name set default expression

修改列名/修改列名並設定為非空限制/修改列名並刪除非空限制alter table table_name alter column column_name;

或alter table table_name alter column column_name set not null;

或alter table table_name alter column column_name drop not null;

刪除字段預設值alter table table_name alter column column_name drop default;

設定字段儲存模式alter table table_name alter column column_name set storage 【plain: 用於定長的數值,內聯且不壓縮的;

external: 用於外部儲存,不壓縮的資料;extended: 用於外部的壓縮資料;main:用於內聯,可壓縮的資料】

新增主鍵約束alter table table_name add constraint constraint_name primary key (key_column_name);

刪除約束alter table table_name drop constraint constraint_name

修改表所存放的表空間alter table table_name set tablespace tablespace_name;

修改表的擁有者(即:將表移到新的使用者下)alter table table_name old_owner_name to new_owner_name;

3.建立及修改表空間

1)建立表空間:

如在 /data/indexes 路徑下建立乙個表空間 tablespace_name,由使用者 owner_name所擁有

create tablespace tablespace_name owner owner_name location '/data/indexes';

2)修改表空間名稱:

alter tablespace old_tablespace_name rename to new_tablespace_name;

3)修改表空間擁有者:

alter tablespace tablespace_name old_owner_name to new_owner_name;

gp資料庫與pg資料庫

以前專案採用的都是oracle或者是mysql的資料庫,新的專案採用了gp資料庫 greenplum 在這之前只聽說過pg資料庫 postgresql gp資料庫官網 pg資料庫官網 經過學習和查詢,得知greenplum是利用了postgre資料庫的框架,也就相當於說是,gp資料庫是基於pg資料庫...

GP資料庫引數配置

作業系統 不支援windows,支援以下類unix作業系統,首選 rhel 6。cpu 記憶體 在gp中,記憶體主要用於在sql執行過程彙總儲存中間結果 如排序 hashjoin等 若記憶體不夠,gp會選擇使用磁碟快取資料,大大降低sql執行的效能。網路 gp建議為segment機器上的每乙個主se...

Oracle 資料庫中的表

oracle 資料庫中的表 使用者定義的表 使用者自己建立並維護的一組表 包含了使用者所需的資訊 資料字典 由oracle server自動建立的一組表 包含資料庫資訊 select table name from user tables select distinct object type fr...