This section provides a high-level overview of the system requirements and feature set of Greenplum Database. It contains the following topics:
The SQL language was first formally standardized in 1986 by the American National Standards Institute (ANSI) as SQL 1986. Subsequent versions of the SQL standard have been released by ANSI and as International Organization for Standardization (ISO) standards: SQL 1989, SQL 1992, SQL 1999, SQL 2003, SQL 2006, and finally SQL 2008, which is the current SQL standard. The official name of the standard is ISO/IEC 9075-14:2008. In general, each new version adds more features, although occasionally features are deprecated or removed.
It is important to note that there are no commercial database systems that are fully compliant with the SQL standard. Greenplum Database is almost fully compliant with the SQL 1992 standard, with most of the features from SQL 1999. Several features from SQL 2003 have also been implemented (most notably the SQL OLAP features).
This section addresses the important conformance issues of Greenplum Database as they relate to the SQL standards. For a feature-by-feature list of Greenplum's support of the latest SQL standard, see SQL 2008 Optional Feature Compliance.
In the process of building a parallel, shared-nothing database system and query optimizer, certain common SQL constructs are not currently implemented in Greenplum Database. The following SQL constructs are not supported:
Some set returning subqueries in EXISTS
or NOT EXISTS
clauses that Greenplum's parallel optimizer cannot rewrite into joins.
Backwards scrolling cursors, including the use of FETCH PRIOR
, FETCH FIRST
, FETCH ABSOLUTE
, and FETCH RELATIVE
.
In CREATE TABLE
statements (on hash-distributed tables): a UNIQUE
or PRIMARY KEY
clause must include all of (or a superset of) the distribution key columns. Because of this restriction, only one UNIQUE
clause or PRIMARY KEY
clause is allowed in a CREATE TABLE
statement. UNIQUE
or PRIMARY KEY
clauses are not allowed on randomly-distributed tables.
CREATE UNIQUE INDEX
statements that do not contain all of (or a superset of) the distribution key columns. CREATE UNIQUE INDEX
is not allowed on randomly-distributed tables.
Note that UNIQUE INDEXES
(but not UNIQUE CONSTRAINTS
) are enforced on a part basis within a partitioned table. They guarantee the uniqueness of the key within each part or sub-part.
VOLATILE
or STABLE
functions cannot run on the segments, and so are generally limited to being passed literal values as the arguments to their parameters.
Triggers are not generally supported because they typically rely on the use of VOLATILE
functions. PostgreSQL Event Triggers are supported because they capture only DDL events.
Referential integrity constraints (foreign keys) are not enforced in Greenplum Database. Users can declare foreign keys and this information is kept in the system catalog, however.
Sequence manipulation functions CURRVAL
and LASTVAL
.
The following features of SQL 1992 are not supported in Greenplum Database:
NATIONAL CHARACTER
(NCHAR
) and NATIONAL CHARACTER VARYING
(NVARCHAR
). Users can declare the NCHAR
and NVARCHAR
types, however they are just synonyms for CHAR
and VARCHAR
in Greenplum Database.CREATE ASSERTION
statement.INTERVAL
literals are supported in Greenplum Database, but do not conform to the standard.GET DIAGNOSTICS
statement.GLOBAL TEMPORARY TABLE
s and LOCAL TEMPORARY TABLE
s. Greenplum TEMPORARY TABLE
s do not conform to the SQL standard, but many commercial database systems have implemented temporary tables in the same way. Greenplum temporary tables are the same as VOLATILE TABLE
s in Teradata.UNIQUE
predicate.MATCH PARTIAL
for referential integrity checks (most likely will not be implemented in Greenplum Database).The following features of SQL 1999 are not supported in Greenplum Database:
Large Object data types: BLOB
, CLOB
, NCLOB
. However, the BYTEA
and TEXT
columns can store very large amounts of data in Greenplum Database (hundreds of megabytes).
MODULE
(SQL client modules).
CREATE PROCEDURE
(SQL/PSM
). This can be worked around in Greenplum Database by creating a FUNCTION
that returns void
, and invoking the function as follows:
SELECT *myfunc*(*args*);
The PostgreSQL/Greenplum function definition language (PL/PGSQL
) is a subset of Oracle's PL/SQL
, rather than being compatible with the SQL/PSM
function definition language. Greenplum Database also supports function definitions written in Python, Perl, Java, and R.
BIT
and BIT VARYING
data types (intentionally omitted). These were deprecated in SQL 2003, and replaced in SQL 2008.
Greenplum supports identifiers up to 63 characters long. The SQL standard requires support for identifiers up to 128 characters long.
Prepared transactions (PREPARE TRANSACTION
, COMMIT PREPARED
, ROLLBACK PREPARED
). This also means Greenplum does not support XA
Transactions (2 phase commit coordination of database transactions with external transactions).
CHARACTER SET
option on the definition of CHAR()
or VARCHAR()
columns.
Specification of CHARACTERS
or OCTETS
(BYTES
) on the length of a CHAR()
or VARCHAR()
column. For example, VARCHAR(15 CHARACTERS)
or VARCHAR(15 OCTETS)
or VARCHAR(15 BYTES)
.
CREATE DISTINCT TYPE
statement. CREATE DOMAIN
can be used as a work-around in Greenplum.
The explicit table construct.
The following features of SQL 2003 are not supported in Greenplum Database:
MERGE
statements.IDENTITY
columns and the associated GENERATED ALWAYS/GENERATED BY DEFAULT
clause. The SERIAL
or BIGSERIAL
data types are very similar to INT
or BIGINT GENERATED BY DEFAULT AS IDENTITY
.MULTISET
modifiers on data types.ROW
data type.nextval('seq')
is used in Greenplum instead of the standard NEXT VALUE FOR seq
.GENERATED ALWAYS AS
columns. Views can be used as a work-around.TABLESAMPLE
) on SELECT
statements. The random()
function can be used as a work-around to get random samples from tables.PARTITION BY
in a join).The following features of SQL 2008 are not supported in Greenplum Database:
BINARY
and VARBINARY
data types. BYTEA
can be used in place of VARBINARY
in Greenplum Database.
The ORDER BY
clause is ignored in views and subqueries unless a LIMIT
clause is also used. This is intentional, as the Greenplum optimizer cannot determine when it is safe to avoid the sort, causing an unexpected performance impact for such ORDER BY
clauses. To work around, you can specify a really large LIMIT
. For example:
SELECT * FROM mytable ORDER BY 1 LIMIT 9999999999
The row subquery construct is not supported.
TRUNCATE TABLE
does not accept the CONTINUE IDENTITY
and RESTART IDENTITY
clauses.
Greenplum Database is based on PostgreSQL 9.4. To support the distributed nature and typical workload of a Greenplum Database system, some SQL commands have been added or modified, and there are a few PostgreSQL features that are not supported. Greenplum has also added features not found in PostgreSQL, such as physical data distribution, parallel query optimization, external tables, resource queues, and enhanced table partitioning. For full SQL syntax and references, see the SQL Commands.
NoteGreenplum Database does not support the PostgreSQL large object facility for streaming user data that is stored in large-object structures.
NoteVMware does not support using
WITH OIDS
oroids=TRUE
to assign an OID system column when creating or altering a table. This syntax is deprecated and will be removed in a future Greenplum release.
SQL Command | Supported in Greenplum | Modifications, Limitations, Exceptions |
---|---|---|
ALTER AGGREGATE |
YES | |
ALTER CONVERSION |
YES | |
ALTER DATABASE |
YES | |
ALTER DOMAIN |
YES | |
ALTER EVENT TRIGGER |
YES | |
ALTER EXTENSION |
YES | Changes the definition of a Greenplum Database extension - based on PostgreSQL 9.6. |
ALTER FUNCTION |
YES | |
ALTER GROUP |
YES | An alias for ALTER ROLE |
ALTER INDEX |
YES | |
ALTER LANGUAGE |
YES | |
ALTER OPERATOR |
YES | |
ALTER OPERATOR CLASS |
YES | |
ALTER OPERATOR FAMILY |
YES | |
ALTER PROTOCOL |
YES | |
ALTER PUBLICATION |
NO | |
ALTER RESOURCE QUEUE |
YES | Greenplum Database resource management feature - not in PostgreSQL. |
ALTER ROLE |
YES | Greenplum Database Clauses:
|
ALTER SCHEMA |
YES | |
ALTER SEQUENCE |
YES | |
ALTER SUBSCRIPTION |
NO | |
ALTER SYSTEM |
NO | |
ALTER TABLE |
YES | Unsupported Clauses / Options:
Greenplum Database Clauses:
|
ALTER TABLESPACE |
YES | |
ALTER TRIGGER |
NO | |
ALTER TYPE |
YES | Greenplum Database Clauses:
|
ALTER USER |
YES | An alias for ALTER ROLE |
ALTER VIEW |
YES | |
ANALYZE |
YES | |
BEGIN |
YES | |
CHECKPOINT |
YES | |
CLOSE |
YES | |
CLUSTER |
YES | |
COMMENT |
YES | |
COMMIT |
YES | |
COMMIT PREPARED |
NO | |
COPY |
YES | Modified Clauses:
Greenplum Database Clauses:
|
CREATE AGGREGATE |
YES | Unsupported Clauses / Options:
Greenplum Database Clauses:
Limitations: The functions used to implement the aggregate must be |
CREATE CAST |
YES | |
CREATE CONSTRAINT TRIGGER |
NO | |
CREATE CONVERSION |
YES | |
CREATE DATABASE |
YES | |
CREATE DOMAIN |
YES | |
CREATE EVENT TRIGGER |
YES | |
CREATE EXTENSION |
YES | Loads a new extension into Greenplum Database - based on PostgreSQL 9.6. |
CREATE EXTERNAL TABLE |
YES | Greenplum Database parallel ETL feature - not in PostgreSQL 9.4. |
CREATE FUNCTION |
YES | Limitations: Functions defined as |
CREATE GROUP |
YES | An alias for CREATE ROLE |
CREATE INDEX |
YES | Greenplum Database Clauses:
Limitations:
|
CREATE LANGUAGE |
YES | |
CREATE MATERIALIZED VIEW |
YES | Based on PostgreSQL 9.4. |
CREATE OPERATOR |
YES | Limitations: The function used to implement the operator must be an |
CREATE OPERATOR CLASS |
YES | |
CREATE OPERATOR FAMILY |
YES | |
CREATE PROTOCOL |
YES | |
CREATE PUBLICATION |
NO | |
CREATE RESOURCE QUEUE |
YES | Greenplum Database resource management feature - not in PostgreSQL 9.4. |
CREATE ROLE |
YES | Greenplum Database Clauses:
|
CREATE RULE |
YES | |
CREATE SCHEMA |
YES | |
CREATE SEQUENCE |
YES | Limitations: The The |
CREATE SUBSCRIPTION |
NO | |
CREATE TABLE |
YES | Unsupported Clauses / Options:
Limited Clauses:
Greenplum Database Clauses:
|
CREATE TABLE AS |
YES | See CREATE TABLE |
CREATE TABLESPACE |
YES | Greenplum Database Clauses: Specify host file system locations for specific segment instances.
|
CREATE TRIGGER |
NO | |
CREATE TYPE |
YES | Greenplum Database Clauses:
Limitations: The functions used to implement a new base type must be |
CREATE USER |
YES | An alias for CREATE ROLE |
CREATE VIEW |
YES | |
DEALLOCATE |
YES | |
DECLARE |
YES | Unsupported Clauses / Options:
Limitations: Cursors cannot be backward-scrolled. Forward scrolling is supported. PL/pgSQL does not have support for updatable cursors. |
DELETE |
YES | |
DISCARD |
YES | Limitation: |
DO |
YES | PostgreSQL 9.0 feature |
DROP AGGREGATE |
YES | |
DROP CAST |
YES | |
DROP CONVERSION |
YES | |
DROP DATABASE |
YES | |
DROP DOMAIN |
YES | |
DROP EVENT TRIGGER |
YES | |
DROP EXTENSION |
YES | Removes an extension from Greenplum Database – based on PostgreSQL 9.6. |
DROP EXTERNAL TABLE |
YES | Greenplum Database parallel ETL feature - not in PostgreSQL 9.4. |
DROP FUNCTION |
YES | |
DROP GROUP |
YES | An alias for DROP ROLE |
DROP INDEX |
YES | |
DROP LANGUAGE |
YES | |
DROP OPERATOR |
YES | |
DROP OPERATOR CLASS |
YES | |
DROP OPERATOR FAMILY |
YES | |
DROP OWNED |
NO | |
DROP PROTOCOL |
YES | |
DROP PUBLICATION |
NO | |
DROP RESOURCE QUEUE |
YES | Greenplum Database resource management feature - not in PostgreSQL 9.4. |
DROP ROLE |
YES | |
DROP RULE |
YES | |
DROP SCHEMA |
YES | |
DROP SEQUENCE |
YES | |
DROP SUBSCRIPTION |
NO | |
DROP TABLE |
YES | |
DROP TABLESPACE |
YES | |
DROP TRIGGER |
NO | |
DROP TYPE |
YES | |
DROP USER |
YES | An alias for DROP ROLE |
DROP VIEW |
YES | |
END |
YES | |
EXECUTE |
YES | |
EXPLAIN |
YES | |
FETCH |
YES | Unsupported Clauses / Options:
Limitations: Cannot fetch rows in a nonsequential fashion; backward scan is not supported. |
GRANT |
YES | |
INSERT |
YES | |
LATERAL Join Type |
NO | |
LISTEN |
YES | |
LOAD |
YES | |
LOCK |
YES | |
MOVE |
YES | See FETCH |
NOTIFY |
YES | |
PREPARE |
YES | |
PREPARE TRANSACTION |
NO | |
REASSIGN OWNED |
YES | |
REFRESH MATERIALIZED VIEW |
YES | Based on PostgreSQL 9.4. |
REINDEX |
YES | |
RELEASE SAVEPOINT |
YES | |
RESET |
YES | |
RETRIEVE |
YES | Greenplum Database parallel retrieve cursor - not in PostgreSQL 9.4. |
REVOKE |
YES | |
ROLLBACK |
YES | |
ROLLBACK PREPARED |
NO | |
ROLLBACK TO SAVEPOINT |
YES | |
SAVEPOINT |
YES | |
SELECT |
YES | Limitations: Limited use of Text search ( Greenplum Database Clauses (OLAP):
|
SELECT INTO |
YES | See SELECT |
SET |
YES | |
SET CONSTRAINTS |
NO | In PostgreSQL, this only applies to foreign key constraints, which are currently not enforced in Greenplum Database. |
SET ROLE |
YES | |
SET SESSION AUTHORIZATION |
YES | Deprecated as of PostgreSQL 8.1 - see SET ROLE |
SET TRANSACTION |
YES | Limitations:
|
SHOW |
YES | |
START TRANSACTION |
YES | |
TRUNCATE |
YES | |
UNLISTEN |
YES | |
UPDATE |
YES | Limitations:
|
VACUUM |
YES | Limitations:
|
VALUES |
YES |