介绍
PB级的装载能力(支持50PB)
遵从sql-92,sql-99, sql-2003,包括sql 2003 OLAP扩展项
原生MapReduce功能
web GUI的greenplum数据仓库系统运行状态监控工具
有人提到,gp最大精华,就是分布式执行计划
Scatter/Gather 流引擎是专为并行数据加载和导出而设计,Scatter指数据通过并行加载服务器并行分散到各个数据节点,Gather指数据在 GPDB内部可以根据分布策略按需并行分发。
模式 schema
使用
连接
yum -y install postgresql
psql -d gp -h 1.2.3.4 -p 5432 -U gpadmin
操作
pqsql命令
help
可以打印出总的帮助信息
\?
有点类似man,可以看到pqsql的命令帮助
数据库
创建:
createdb -h 192.168.123.92 -p 5432 -U gpadmin db_t
查看数据库列表
psql -l -h 192.168.123.92 -p 5432 -U gpadmin
[root@slb1 ~]# psql -l -h 192.168.123.92 -p 5432 -U gpadmin
List of databases
Name | Owner | Encoding | Access privileges -----------+---------+----------+---------------------
db_t | gpadmin | UTF8 |
列出所有数据库
db_t=# \l
List of databases
Name | Owner | Encoding | Access privileges
-----------+---------+----------+---------------------
db_t | gpadmin | UTF8 |
gp | gpadmin | UTF8 |
postgres | gpadmin | UTF8 |
shajia | gpadmin | UTF8 |
template0 | gpadmin | UTF8 | =c/gpadmin
: gpadmin=CTc/gpadmin
template1 | gpadmin | UTF8 | =c/gpadmin
: gpadmin=CTc/gpadmin
(6 rows)
表
创建表
db_t=# CREATE TABLE t1 ( i1 int PRIMARY KEY,i2 int,s1 varchar(40) );
如果给出了模式名(比如,CREATE TABLE myschema.mytable …), 那么表是在指定模式中创建的。否则它在当前模式中创建。
create TABLE t_schema.t3 ( i1 int PRIMARY KEY,s1 varchar(40) );
列出表的详细信息
db_t=# \d+ t3
Table "t_schema.t3"
Column | Type | Modifiers | Storage | Description
--------+-----------------------+-----------+----------+-------------
i1 | integer | not null | plain |
i2 | integer | | plain |
s1 | character varying(40) | | extended |
Indexes:
"t3_pkey" PRIMARY KEY,btree (i1)
Has OIDs: no
列出当前模式schema下所有表
db_t=# \dt
List of relations
Schema | Name | Type | Owner
--------+------+-------+---------
public | t1 | table | gpadmin
(1 row)
查看所有表,抛开模式schema
db_t=# select schemaname,tablename,tableowner from pg_tables;
schemaname | tablename | tableowner
--------------------+-------------------------------+------------
information_schema | sql_languages | gpadmin
information_schema | sql_packages | gpadmin
... | ... | ...
public | t1 | gpadmin
public | t2 | gpadmin
t_schema | t3 | gpadmin
(90 rows)
模式
列出模式
db_t=# \dn
List of schemas
Name | Owner
--------------------+---------
gp_toolkit | gpadmin
information_schema | gpadmin
pg_aoseg | gpadmin
pg_bitmapindex | gpadmin
pg_catalog | gpadmin
pg_toast | gpadmin
public | gpadmin
(7 rows)
创建新模式schema
CREATE SCHEMA t_schema;
删除模式schema
DROP SCHEMA t_schema;
查看当前模式
db_t=# SHOW search_path;
search_path ----------------
"$user",public
(1 row)
修改默认模式
db_t=# SET search_path=t_schema;
SET Time: 14.754 ms db_t=# SHOW search_path;
search_path
-------------
t_schema
(1 row)
其他
#显示命令执行的时间
\timing