Skip to main content
Making CockroachDB easy to use is a top priority for us, so we chose to implement SQL. However, even though SQL has a standard, no database implements all of it, nor do any of them have standard implementations of all features. To understand which standard SQL features we support (as well as common extensions to the standard), use the table below.
  • Component lists the components that are commonly considered part of SQL.
  • Supported shows CockroachDB’s level of support for the component.
  • Type indicates whether the component is part of the SQL Standard or is an Extension created by ourselves or others.
  • Details provides greater context about the component.

Features

Row values

ComponentSupportedTypeDetails
ARRAYStandard
AUTO INCREMENT
(Automatic key generation)
AlternativeCommon Extension
BITStandard
BOOLEANStandard
BYTESCockroachDB Extension
COLLATEStandard
DATEStandard
DECIMAL, NUMERICStandard
ENUMPostgreSQL Extension
FLOAT, REALStandard
INETPostgreSQL Extension
INTStandard
INTERVALStandard
JSON/JSONBCommon Extension
NULLStandard
OIDPostgreSQL Extension
SERIALPostgreSQL Extension
SETMySQLOnly allow rows to contain values from a defined set of terms.
STRING, CHARACTERStandard
TIMEStandard
TIMESTAMP/TIMESTAMPTZStandard
TSQUERYStandard
TSVECTORStandard
UNSIGNED INTCommon ExtensionUNSIGNED INT causes numerous casting issues, so we do not plan to support it.
UUIDPostgreSQL Extension
IdentifiersStandard. See also .
Key-value pairsAlternativeExtension
XMLStandardXML data can be stored as BYTES, but we do not offer XML parsing.

Constraints

ComponentSupportedTypeDetails
Not NullStandard
UniqueStandard
Primary KeyStandard
CheckStandard
Foreign KeyStandard
Default ValueStandard

Transactions

ComponentSupportedTypeDetails
Transactions (ACID semantics)Standard
BEGINStandard
COMMITStandard
ROLLBACKStandard
SAVEPOINTStandard with CockroachDB extensionsCockroachDB supports nested transactions using

Indexes

ComponentSupportedTypeDetails
IndexesCommon Extension
Multi-column indexesCommon ExtensionWe do not limit on the number of columns indexes can include
Covering indexesCommon Extension
GIN indexesCommon Extension
Trigram indexesPostgreSQL Extension
Partial indexesCommon Extension
Spatial indexesCommon Extension
Multiple indexes per queryPartialCommon Extension
Full-text indexesCommon Extension
Expression indexesCommon Extension
Prefix indexesCommon ExtensionImplement using
Hash indexesCommon ExtensionImproves performance of queries looking for single, exact values
Hash-sharded indexesCockroachDB Extension

Schema changes

ComponentSupportedTypeDetails
ALTER TABLEStandard
Database renamesStandard
Table renamesStandard
Column renamesStandard
Altering a column’s data typeStandard
Adding columnsStandard
Removing columnsStandard
Adding constraintsStandard
Removing constraintsStandard
Index renamesStandard
Adding indexesStandard
Removing indexesStandard
Altering a primary keyStandard
Adding user-defined schemasStandard
Removing user-defined schemasStandard
Altering user-defined schemasStandard

Statements

ComponentSupportedTypeDetails
Common statementsStandard, PostgreSQL/CockroachDB Extension
UPSERTPostgreSQL, MSSQL Extension
EXPLAINCommon Extension
SELECT INTOAlternativeCommon ExtensionYou can replicate similar functionality using and then INSERT INTO ... SELECT ....
SELECT FOR UPDATECommon Extension

Clauses

ComponentSupportedTypeDetails
Common clausesStandard
LIMITCommon ExtensionLimit the number of rows a statement returns. For more information, see .
LIMIT with OFFSETCommon ExtensionSkip a number of rows, and then limit the size of the return set. For more information, see .
RETURNINGCommon ExtensionRetrieve a table of rows statements affect. For examples, see the and documentation.

Table expressions

ComponentSupportedTypeDetails
Table and View referencesStandard
AS in table expressionsStandard
JOIN (INNER, LEFT, RIGHT, FULL, CROSS)Standard
Sub-queries as table expressionsPartialStandardNon-correlated subqueries are , as are most .
Table generator functionsPartialPostgreSQL Extension
WITH ORDINALITYCockroachDB Extension

Scalar expressions and Boolean formulas

ComponentSupportedTypeDetails
Common functionsStandard
Common operatorsStandard
IF/CASE/NULLIFStandard
COALESCE/IFNULLStandard
AND/ORStandard
LIKE/ILIKEStandard
SIMILAR TOStandard
Matching using POSIX regular expressionsCommon Extension
EXISTSPartialStandardNon-correlated subqueries are , as are most . Works only with small data sets.
Scalar subqueriesPartialStandardNon-correlated subqueries are , as are most . Works only with small data sets.
Bitwise arithmeticCommon Extension
Array constructors and subscriptingPartialPostgreSQL ExtensionArray expression documentation: and
COLLATEStandard
Column ordinal referencesCockroachDB Extension
Type annotationsCockroachDB Extension

Permissions

ComponentSupportedTypeDetails
UsersStandard
RolesStandard
Object ownershipCommon Extension
PrivilegesStandard
Default privilegesPostgreSQL Extension

Miscellaneous

ComponentSupportedTypeDetails
Column familiesCockroachDB Extension
Computed columns (stored and virtual)Common Extension
ON UPDATE expressionsMySQL Extension
Multi-region capabilitiesCockroachDB Extension
System catalog schemasStandard, PostgreSQL/CockroachDB Extension (CockroachDB Extension)
(Standard)
(PostgreSQL Extension)
(PostgreSQL Extension)
SequencesCommon Extension
Identity columnsCommon Extension
ViewsStandard
Materialized viewsCommon Extension
Window functionsStandard
Common table expressionsPartialCommon Extension
Stored proceduresCommon ExtensionExecute a procedure explicitly.
CursorsPartialStandard
TriggersStandardExecute a set of commands whenever a specified event occurs.
Row-level TTLCommon ExtensionAutomatically delete expired rows. For more information, see .
User-defined functionsPartialStandard
CREATE EXTENSION "uuid-ossp"Common ExtensionProvides access to several additional . Note that these UUID functions are available without typing CREATE EXTENSION "uuid-ossp". CockroachDB does not have full support for CREATE EXTENSION.