SQL Feature Support in CockroachDB v19.1

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
IdentifiersStandardIdentifiers documentation
INTStandardINT documentation
FLOAT, REALStandardFLOAT documentation
BOOLEANStandardBOOL documentation
DECIMAL, NUMERICStandardDECIMAL documentation
NULLStandardNULL-handling documentation
BYTESCockroachDB ExtensionBYTES documentation
Automatic key generationCommon ExtensionAutomatic key generation FAQ
STRING, CHARACTERStandardSTRING documentation
COLLATEStandardCOLLATE documentation
AUTO INCREMENTAlternativeCommon ExtensionAutomatic key generation FAQ
Key-value pairsAlternativeExtensionKey-Value FAQ
ARRAYStandardARRAY documentation
UUIDPostgreSQL ExtensionUUID documentation
JSONCommon ExtensionJSONB documentation
TIMEStandardTIME documentation
XMLStandardXML data can be stored as BYTES, but we do not offer XML parsing.
UNSIGNED INTCommon ExtensionUNSIGNED INT causes numerous casting issues, so we do not plan to support it.
SET, ENUMMySQL, PostgreSQL ExtensionOnly allow rows to contain values from a defined set of terms.
INETPostgreSQL ExtensionINET documentation

Constraints

ComponentSupportedTypeDetails
Not NullStandardNot Null documentation
UniqueStandardUnique documentation
Primary KeyStandardPrimary Key documentation
CheckStandardCheck documentation
Foreign KeyStandardForeign Key documentation
Default ValueStandardDefault Value documentation

Transactions

ComponentSupportedTypeDetails
Transactions (ACID semantics)StandardTransactions documentation
BEGINStandardBEGIN documentation
COMMITStandardCOMMIT documentation
ROLLBACKStandardROLLBACK documentation
SAVEPOINTCockroachDB ExtensionWhile SAVEPOINT is part of the SQL standard, we only support our extension of it

Indexes

ComponentSupportedTypeDetails
IndexesCommon ExtensionIndexes documentation
Multi-column indexesCommon ExtensionWe do not limit on the number of columns indexes can include
Covering indexesCommon ExtensionStoring Columns documentation
Inverted indexesCommon ExtensionInverted Indexes documentation
Multiple indexes per queryPlannedCommon ExtensionUse multiple indexes to filter the table's values for a single query
Full-text indexesPlannedCommon ExtensionGitHub issue tracking full-text index support
Prefix/Expression IndexesPotentialCommon ExtensionApply expressions (such as LOWER()) to values before indexing them
Geospatial indexesPotentialCommon ExtensionImproves performance of queries calculating geospatial data
Hash indexesCommon ExtensionImproves performance of queries looking for single, exact values
Partial indexesCommon ExtensionOnly index specific rows from indexed columns

Schema changes

ComponentSupportedTypeDetails
ALTER TABLEStandardALTER TABLE documentation
Database renamesStandardRENAME DATABASE documentation
Table renamesStandardRENAME TABLE documentation
Column renamesStandardRENAME COLUMN documentation
Adding columnsStandardADD COLUMN documentation
Removing columnsStandardDROP COLUMN documentation
Adding constraintsStandardADD CONSTRAINT documentation
Removing constraintsStandardDROP CONSTRAINT documentation
Index renamesStandardRENAME INDEX documentation
Adding indexesStandardCREATE INDEX documentation
Removing indexesStandardDROP INDEX documentation

Statements

ComponentSupportedTypeDetails
Common statementsStandardSQL Statements documentation
UPSERTPostgreSQL, MSSQL ExtensionUPSERT documentation
EXPLAINCommon ExtensionEXPLAIN documentation
SELECT INTOAlternativeCommon ExtensionYou can replicate similar functionality using CREATE TABLE and then INSERT INTO … SELECT ….

Clauses

ComponentSupportedTypeDetails
Common clausesStandardSQL Grammar documentation
LIMITCommon ExtensionLimit the number of rows a statement returns.
LIMIT with OFFSETCommon ExtensionSkip a number of rows, and then limit the size of the return set.
RETURNINGCommon ExtensionRetrieve a table of rows statements affect.

Table expressions

ComponentSupportedTypeDetails
Table and View referencesStandardTable expressions documentation
AS in table expressionsStandardAliased table expressions documentation
JOIN (INNER, LEFT, RIGHT, FULL, CROSS)FunctionalStandardJoin expressions documentation
Sub-queries as table expressionsPartialStandardNon-correlated subqueries are supported, as are most correlated subqueries.
Table generator functionsPartialPostgreSQL ExtensionTable generator functions documentation
WITH ORDINALITYCockroachDB ExtensionOrdinality annotation documentation

Scalar expressions and boolean formulas

ComponentSupportedTypeDetails
Common functionsStandardFunctions calls and SQL special forms documentation
Common operatorsStandardOperators documentation
IF/CASE/NULLIFStandardConditional expressions documentation
COALESCE/IFNULLStandardConditional expressions documentation
AND/ORStandardConditional expressions documentation
LIKE/ILIKEStandardString pattern matching documentation
SIMILAR TOStandardSQL regexp pattern matching documentation
Matching using POSIX regular expressionsCommon ExtensionPOSIX regexp pattern matching documentation
EXISTSPartialStandardNon-correlated subqueries are supported, as are most correlated subqueries. Currently works only with small data sets.
Scalar subqueriesPartialStandardNon-correlated subqueries are supported, as are most correlated subqueries. Currently works only with small data sets.
Bitwise arithmeticCommon ExtensionOperators documentation
Array constructors and subscriptingPartialPostgreSQL ExtensionArray expression documentation: Constructor syntax and Subscripting
COLLATEStandardCollation expressions documentation
Column ordinal referencesCockroachDB ExtensionColumn references documentation
Type annotationsCockroachDB ExtensionType annotations documentation

Permissions

ComponentSupportedTypeDetails
UsersStandardGRANT documentation
PrivilegesStandardPrivileges documentation

Miscellaneous

ComponentSupportedTypeDetails
Column familiesCockroachDB ExtensionColumn Families documentation
Interleaved tablesCockroachDB ExtensionInterleaved Tables documentation
Parallel Statement ExecutionCockroachDB ExtensionParallel Statement Execution documentation
Information SchemaStandardInformation Schema documentation
ViewsStandardViews documentation
Window functionsStandardWindow Functions documentation
Common Table ExpressionsPartialCommon ExtensionCommon Table Expressions documentation
Stored ProceduresPlannedCommon ExtensionExecute a procedure explicitly.
CursorsStandardTraverse a table's rows.
TriggersStandardExecute a set of commands whenever a specified event occurs.
SequencesCommon ExtensionCREATE SEQUENCE documentation

Was this page helpful?
YesNo