SERIAL

Overview

This is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.

USAGE

SERIAL

DETAILS

Data Type

Minimum Value

Maximum Value

SERIAL

0

18446744073709551615

AUTO_INCREMENT vs. AUTO_UNIQUE

MariaDB Xpand can provide better performance by using AUTO_UNIQUE constraints instead of AUTO_INCREMENT. Therefore, if performance is a concern, MariaDB recommends defining columns as BIGINT(0) UNSIGNED AUTO_UNIQUE NOT NULL, rather than using the SERIAL data type.

For additional information about AUTO_UNIQUE constraints, see "AUTO_UNIQUE Constraints with MariaDB Xpand".

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

While Xpand accepts the SERIAL data type on table create, it is silently replaced with BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE:

CREATE TABLE serial_example (
   id SERIAL PRIMARY KEY,
   data VARCHAR(32)
);
SHOW CREATE TABLE serial_example\G
*************************** 1. row ***************************
       Table: serial_example
Create Table: CREATE TABLE `serial_example` (
  `id` bigint(20) unsigned not null AUTO_INCREMENT,
  `data` varchar(32) CHARACTER SET utf8,
  PRIMARY KEY (`id`) /*$ PAYLOAD (`data`) DISTRIBUTE=1 */
) AUTO_INCREMENT=1 CHARACTER SET utf8 /*$ SLICES=3 */

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES