当前位置:网站首页>Gbase8s unique index and non unique index
Gbase8s unique index and non unique index
2022-07-03 05:01:00 【The heart sea is ordinary】
Unique indexes are not allowed to have duplicate values in columns , It can be used to define and constrain the combined values of one or more columns in the table , In execution insert and update Statement needs to be checked for uniqueness .GBase8s Middle primary key (PRIMARY KEY) Will automatically create a unique index . A good table design should define a primary key or a unique constraint index . Especially in OLTP In the system , A unique index can help quickly locate a small number of records .
Syntax for creating unique indexes :
CREATE UNIQUE INDEX idx_name ON tabname(col);perhaps
CREATE DISTINCT INDEX idx_name ON tabname(col);Non unique index ( Repeatable index ) You can create , Allow duplicate data in columns . However, it is necessary to avoid creating indexes on data columns with duplicate subkeys , Because the index with more duplicate values , The lower its efficiency .
The example diagram of unique index and non unique index is as follows :

Be careful : Because of the need in insert、update Make uniqueness judgment when , Therefore, it is not recommended to create multiple unique indexes on a table . To ensure uniqueness requirements , Generally, it is enough to create a unique index in a table .
边栏推荐
- The principle is simple, but I don't know how to use it? Understand "contemporaneous group model" in one article
- RT thread flow notes I startup, schedule, thread
- I stepped on a foundation pit today
- [research materials] 2021 annual report on mergers and acquisitions in the property management industry - Download attached
- "Niuke brush Verilog" part II Verilog advanced challenge
- Three representations of signed numbers: original code, inverse code and complement code
- First + only! Alibaba cloud's real-time computing version of Flink passed the stability test of big data products of the Institute of ICT
- Market status and development prospects of the global automatic tea picker industry in 2022
- Kept hot standby and haproxy
- 1114 family property (25 points)
猜你喜欢

Basic knowledge of reflection (detailed explanation)
![[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa](/img/a9/92059db74ccde03b84c69dfce35b37.jpg)
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa

移动端——uniapp开发记录(公共请求request封装)

leetcode452. Detonate the balloon with the minimum number of arrows

The principle is simple, but I don't know how to use it? Understand "contemporaneous group model" in one article

Review the old and know the new: Notes on Data Science

Three representations of signed numbers: original code, inverse code and complement code

Sdl2 + OpenGL glsl practice (Continued)
![[clock 223] [binary tree] [leetcode high frequency]: 102 Sequence traversal of binary tree](/img/0f/bc8c44aee7a2c9dccac050b1060017.jpg)
[clock 223] [binary tree] [leetcode high frequency]: 102 Sequence traversal of binary tree

ZABBIX monitoring of lamp architecture (3): zabbix+mysql (to be continued)
随机推荐
1115 counting nodes in a BST (30 points)
LVS load balancing cluster of efficient multi-purpose cluster (NAT mode)
Shuttle + Alluxio 加速内存Shuffle起飞
[set theory] binary relation (example of binary relation operation | example of inverse operation | example of composite operation | example of limiting operation | example of image operation)
Market status and development prospects of the global automatic tea picker industry in 2022
The least operation of leetcode simple problem makes the array increment
最大连续子段和(动态规划,递归,递推)
1106 lowest price in supply chain (25 points)
1086 tree traversals again (25 points)
[set theory] relation properties (reflexivity | reflexivity theorem | reflexivity | reflexivity theorem | example)
Online VR model display - 3D visual display solution
First + only! Alibaba cloud's real-time computing version of Flink passed the stability test of big data products of the Institute of ICT
1103 integer factorization (30 points)
Notes | numpy-08 Advanced index
Unity tool Luban learning notes 1
1099 build a binary search tree (30 points)
[luatos sensor] 2 air pressure bmp180
M1 Pro install redis
移动端——uniapp开发记录(公共请求request封装)
Hire cashier (differential constraint)