greenplum基本使用操作

psql -d postgres
psql是greenplum登陆命令,-d选项是指定GP的某个库进行登入,greenplum必须要指定一个库才能登入,postgres是初始化时默认创建的。

gpstart:启动GP

gpstop:关闭GP

gpstop -r :重启GP

gpstop -u:重新加载GP配置文件,该方式不重启GP,等于reload

postgres=$ h
基本SQL语法查看方式,使用帮助

create database data;drop database data
创建数据库;删除数据库

data=# create table test(id int primary key,name varchar(128));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index “test_pkey” for table “test”
CREATE TABLE
data=# select * from test;
创建表(结构)
查询表数据

data=# dt
List of relations
Schema | Name | Type | Owner | Storage
--------±-----±------±--------±--------
public | test | table | gpadmin | heap
(1 row)
列出数据库中所有的表

data=# explain select * from test;
查看查询计划

原文地址:https://www.cnblogs.com/caiwuzi/p/13206219.html