Performance evaluation of secondary index writing of TiDB, OceanBase, PolarDB-X and CockroachDB

Why do you do this test

Secondary index is a key difference between relational database and NoSQL database. The secondary index must be strongly consistent, so the writing of the index and the writing of the primary key need to be placed in the same transaction, and the performance of the transaction is the basis of the performance of the secondary index.

At present, there are several mainstream forms of distributed databases in the market from the perspective of user experience:

  1. Pure transparent usage represented by TiDB and CockroachDB. From the perspective of performance, all tables in this type of database are distributed tables, and there is no need to specify partition keys. Its core logic is to use distributed transactions to maintain global indexes, and use global indexes to completely replace secondary indexes in a single database.
  2. Pure manual usage represented by OceanBase. In terms of performance, this type of database exists in the form of a single table without specifying a partition key, which is not extensible; Creating distributed tables requires a syntax similar to partitioned tables. This type of database also generally provides the ability of global indexing (we generally call it middleware rather than database). However, unlike the first type, they generally take the global index as an option, which is manually specified and created by the user. In addition, they also provide local indexes (local indexes) based on stand-alone transaction implementations.
  3. PolarDB-X of the above two uses is provided at the same time. Without specifying a partition key, similar to the first type of database, distributed tables + global indexes are used to provide a transparent distributed experience; It also allows you to manually specify the partition key, and use techniques such as local indexing to improve performance.
    In the previous article PolarDB-X data distribution interpretation (IV): transparent vs manual, we proposed:
  4. Transparent (automatic) ease of use determines the lower limit of distributed database, but there is a higher cost in performance
  5. Manual can provide the best performance, but the threshold for use will increase

Distributed databases need to provide the ability to be used transparently for most scenarios, and the ability to manually tune and eliminate distributed transactions for a few scenarios with high performance requirements.

The important basis of this view is that the pure transparent mode essentially uses distributed transaction + global index to replace the transaction + index in a stand-alone database, and there is a large performance difference between distributed transaction + global index and stand-alone transaction + index.

This test will focus on the index performance of different distributed databases, especially the performance difference between the industry's global index and MySQL index.

The products tested in this test include TiDB, OB, PolarDB-X and CockroachDB. These databases are selected for the following reasons:

  1. They all provide strong and consistent global indexing capabilities, which are databases rather than middleware.
  2. They are all open-source and provided by cloud products. They have a long history and a lot of information. They are not PPT databases, so it is easy to understand the internal principles.
  3. They are mainly OLTP oriented databases.
    In addition, we also tested the index performance of MySQL for comparison.

test method

Because the hardware configuration (for example, the OB uses 6 machines (and the tenant settings do not cover the whole machine), TiDB and TiKV use 5 machines, PolarDB-X and MySQL are purchased directly from the public cloud), system parameters, and so on, are not exactly the same for each database, and are not necessarily the best, it is meaningless to directly compare TPS.

We will take the peak that TPS can achieve without index for each database as the baseline (100%), and compare the percentage of performance of different index numbers relative to the baseline.

For example, product A can run to 10W TPS without an index and 5W with an index, so we think it is 50% of the baseline with an index. This percentage may be called TPS percentage.

In the horizontal comparison between products, we will compare the percentage of TPS under the same index number, not the absolute value of TPS.

When testing the TPS percentage, we will adjust the concurrency to find the concurrency that can reach the maximum TPS, and calculate the TPS percentage with the maximum TPS.

In addition to the TPS percentage, we will also test the RT of each product in a single write with different index numbers. In the RT test, we will use a single thread to write.

In this test, we only test the insert scenario, which is the most basic function of index writing. We use the OLTP of sysbench_ insert. Lua manufacturing flow. Since we want to test multiple indexes, we have modified the table structure of sysbench. Take MySQL as an example, the modifications are as follows:

CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL ,
        `k1` int(11) NOT NULL ,
        `k2` int(11) NOT NULL ,
        `k3` int(11) NOT NULL ,
        `k4` int(11) NOT NULL ,
        `k5` int(11) NOT NULL ,
        `k6` int(11) NOT NULL ,
        `k7` int(11) NOT NULL ,
        `k8` int(11) NOT NULL ,
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`)
);

We have added 8 columns to the table. According to the number of indexes tested, a corresponding number of secondary indexes will be created on these 8 columns.

At the same time, we need to modify oltp_insert.lua, add these eight columns in the INSERT statement. The values of the eight columns are randomly generated without order, so as to avoid hot spots on databases (TiDB and CockroachDB) partitioned based on range:

con:query(string.format("INSERT INTO %s (id,k,k1,k2,k3,k4,k5,k6,k7,k8,c,pad) VALUES " ..
                                "(%d, %d,%d,%d,%d,%d,%d,%d,%d,%d,'%s','%s')",
                             table_name, i, k_val, sysbench.rand.default(1, sysbench.opt.table_size),sysbench.rand.default(1, sysbench.opt.table_size),sysbench.rand.default(1, sysbench.opt.table_size),sysbench.rand.default(1, sysbench.opt.table_size),sysbench.rand.default(1, sysbench.opt.table_size),sysbench.rand.default(1, sysbench.opt.table_size),sysbench.rand.default(1, sysbench.opt.table_size),sysbench.rand.default(1, sysbench.opt.table_size),c_val, pad_val))

Due to the different syntax and characteristics of different databases (of course, there are some pits), the table building statements of each database may be modified. The table building statements ultimately used by each database are placed in the appendix.

Software and hardware environment

The machine used in this test uses ECS purchased from Alibaba cloud. The specification is ecs.i2g.8xlarge:

The operating system is CentOS 8.3 provided on Alibaba cloud:

All machines are in the same availability area in the same region.
The data files of all databases are placed in the local SSD.
All databases will have an SLB in front for load balancing.
sysbench uses version 1.0.20.

test result


We can see that in the global indexes implemented by these distributed databases, even if there is only one index, the performance will fall below 30%. In the case of eight indexes, the performance will basically fall below 10%.

For a stand-alone database such as MySQL, the performance remains above 85% with 8 indexes.

It confirms that we are https://zhuanlan.zhihu.com/p/... The point I mentioned is that "there is still an insurmountable gap in cost (or performance) between distributed transactions and stand-alone transactions, which is at least three times larger".

Using global indexes instead of single database indexes will bring high costs. In cost sensitive scenarios, local indexes need to be used appropriately to reduce the use costs.

In a database that provides a local index:
● the local indexes of PolarDB-X and OB have affinity with the primary keys in Locality, and can use single machine transactions to write indexes, which maintains very high performance compared with global indexes.
● although TiDB provides local indexes, its indexes and primary keys do not have affinity on Locality, and cannot be bound to the same machine. Therefore, its local indexes still need to be maintained using distributed transactions, which is not much different from the global indexes in performance and costs a lot.
● the local index of CockroachDB is similar to the behavior of TiDB in theory, but the partition function of CockroachDB is only provided in the commercial version, so it is not tested this time

For TiDB and CockroachDB, the situation is embarrassing, because the cost of all indexes they provide is much higher than that of single MySQL. As a user, there is no way to eliminate this cost, unless you do not use secondary index.

From the perspective of RT:

  1. Because of the minimum network interaction of transactions, RT performs best in a stand-alone database, and has little to do with the number of indexes.
  2. The transaction of distributed database needs more cross node interaction, so RT is obviously larger than that of stand-alone database. However, since distributed databases generally adopt the strategy of parallel writing in multi branch transactions, the RT of the database with good performance does not increase linearly with the increase of the number of indexes. Generally speaking, RT is acceptable.
  3. The RT performance of the CockroachDB global index is the worst, which may be related to the use of HLC in the transaction strategy. The other databases use the TSO scheme.
  4. The RT performance of TiDB global indexes is the best. There is almost no change in the RT of 0-8 indexes, which indicates that parallel optimization is very good.
  5. The RT of the global index of our product PolarDB-X seems to have room for optimization. Although the rise is limited, it has not been fully parallel. We will optimize it in subsequent versions. The local index RT is very stable and low.
  6. OB's global index and local index performance are similar to that of PolarDB-X. there is room for improvement in parallel optimization, and local index performance is good.

An additional finding in the test process is that the auto_increment/serial of TiDB, OB and CockroachDB all have serious performance problems, and they all need to use random alternatives. TiDB and CockroachDB are caused by the hot range brought by time order, and ob may be caused by some internal locks. Compatibility includes function compatibility and performance compatibility. The road to performance compatibility is long

Attached below are the results of each database test.

Test details

MySQL

Environment configuration

Version: 5.7.14-AliSQL-X-Cluster-1.5.1.8-20201229-log
Specification: 32C128G, exclusive
Alibaba cloud purchase:

test result

OceanBase

Environment configuration

Version: community version 3.1.4

Tenant configuration:

CREATE RESOURCE UNIT unit1 MAX_CPU 16, MAX_MEMORY '32G', MAX_IOPS 12800,MAX_DISK_SIZE '1000G', MAX_SESSION_NUM 6400, MIN_CPU=8, MIN_MEMORY='16G', MIN_IOPS=12800;
CREATE RESOURCE POOL pool1 UNIT='unit1',UNIT_NUM=2,ZONE_LIST=('zone1','zone2','zone3');
CREATE TENANT idx_test CHARSET='utf8mb4', ZONE_LIST=('zone1','zone2','zone3'), PRIMARY_ZONE='zone1;zone2,zone3', RESOURCE_POOL_LIST=('pool1') ;

Points needing attention:

  1. The table in OB is a single table by default (only distributed on one node). It needs to use the syntax of partitioned table and specify the partition key and partition number to become a distributed table
  2. OB default index is local index. Global keyword needs to be specified to be global index
  3. The global index of OB is also a single table by default (there is only one partition and it is only distributed on one node). You need to manually specify the number of partitions to be a truly distributed index
  4. UNIT_ In the case of num = 1, it seems that even partition tables are on the same machine, so the number of test machines should be > = 6, and ensure that unit_ NUM>=2
  5. If the OB global index is directly specified in the table creation statement, it does not seem to support specifying the number of partitions. Therefore, the global index needs to be created using a separate CREATE INDEX statement
  6. Auto of OB partition table_ The increase attribute seems to have serious performance problems. After it is set, the performance is very low. You should remove this attribute and set the auto of sysbench to_ Inc is set to off, and sysbench generates the primary key value
  7. The time service used by OB by default is local time service (LTS). In this mode, global index is not supported and needs to be manually modified to global time service (GTS):
    SET GLOBAL ob_timestamp_service='GTS';

test result

Global index:

Local index:

TiDB

Environment configuration

Version: 6.1.0
Deployment structure:

Points needing attention:

  1. There is no word "global index" in TiDB syntax, but from the perspective of principle, any table in TiDB is a distributed table, and any secondary index is a global index. It has no concept of a single table
  2. Do not use AUTO_INCREMENT. Auto in TiDB_ Although the increment is segmented and does not guarantee self increasing continuity, it still has a certain time sequence after a long time, so it will lead to hot spots. Auto is required_ Random replaces AUTO_INCREMENT.
  3. The partition syntax is supported in TiDB, but its partition is still built on the distributed KV, which means that each partition corresponds to one or more ranges in TiKV (note that the range here and the range in partition syntax are two different things, and one range in partition syntax may also correspond to ranges in multiple TiKV). These ranges will be freely scheduled. An index created on a table that uses the partition syntax is also called a local index in function.

    test result

    Global index:

    Local index:

    CockroachDB

    Environment configuration

    Version: 22.1.6

    The architecture of CDB and TiDB is similar. Tables are built on distributed KV. All tables are distributed tables, and all indexes are global indexes. There is no single table concept.

Points needing attention:

  1. In CDB, use Serial type primary key (similar to auto_increment in mysql), or use unique_rowid() is used as the primary key, because both of them have a certain time sequence, which will generate significant hotspots and can hardly be used. Use UUID type columns in the test, and use gen_random_uuid() generates the primary key. This is essentially a string, which can be considered disordered in the division of the KV layer range.
  2. CDB has a high cost per connection and cannot create too many connections

    test result

    Global index:

PolarDB-X

Environment configuration

Specification: public cloud 8C32G*2
Version: 5.4.13
be careful:

  1. When building a database, you need to use mode=auto. This type of database table is a distributed table without specifying a partition key, and the index is a global index.
  2. Add the Local keyword before the index to create only the Local index

    test result

    Global index:

    Local index:

appendix

OceanBase global index table creation statement

create database sbtest_gsi8;
use sbtest_gsi8;
CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL,
`k` int(11) NOT NULL ,
`k1` int(11) NOT NULL ,
`k2` int(11) NOT NULL ,
`k3` int(11) NOT NULL ,
`k4` int(11) NOT NULL ,
`k5` int(11) NOT NULL ,
`k6` int(11) NOT NULL ,
`k7` int(11) NOT NULL ,
`k8` int(11) NOT NULL ,
`c` char(120) NOT NULL ,
`pad` char(60) NOT NULL ,
PRIMARY KEY (`id`)
) partition by hash(id)  partitions 32;
create index k_1 on sbtest1(k1) global partition by hash(k1) partitions 32;
create index k_2 on sbtest1(k2) global partition by hash(k2) partitions 32;
create index k_3 on sbtest1(k3) global partition by hash(k3) partitions 32;
create index k_4 on sbtest1(k4) global partition by hash(k4) partitions 32;
create index k_5 on sbtest1(k5) global partition by hash(k5) partitions 32;
create index k_6 on sbtest1(k6) global partition by hash(k6) partitions 32;
create index k_7 on sbtest1(k7) global partition by hash(k7) partitions 32;
create index k_8 on sbtest1(k8) global partition by hash(k8) partitions 32;


create database sbtest_gsi4;
use sbtest_gsi4;

CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL,
`k` int(11) NOT NULL ,
`k1` int(11) NOT NULL ,
`k2` int(11) NOT NULL ,
`k3` int(11) NOT NULL ,
`k4` int(11) NOT NULL ,
`k5` int(11) NOT NULL ,
`k6` int(11) NOT NULL ,
`k7` int(11) NOT NULL ,
`k8` int(11) NOT NULL ,
`c` char(120) NOT NULL ,
`pad` char(60) NOT NULL ,
PRIMARY KEY (`id`)
) partition by hash(id)  partitions 32;
create index k_1 on sbtest1(k1) global partition by hash(k1) partitions 32;
create index k_2 on sbtest1(k2) global partition by hash(k2) partitions 32;
create index k_3 on sbtest1(k3) global partition by hash(k3) partitions 32;
create index k_4 on sbtest1(k4) global partition by hash(k4) partitions 32;


create database sbtest_gsi2;
use sbtest_gsi2;
CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL,
`k` int(11) NOT NULL ,
`k1` int(11) NOT NULL ,
`k2` int(11) NOT NULL ,
`k3` int(11) NOT NULL ,
`k4` int(11) NOT NULL ,
`k5` int(11) NOT NULL ,
`k6` int(11) NOT NULL ,
`k7` int(11) NOT NULL ,
`k8` int(11) NOT NULL ,
`c` char(120) NOT NULL ,
`pad` char(60) NOT NULL ,
PRIMARY KEY (`id`)
) partition by hash(id)  partitions 32;
create index k_1 on sbtest1(k1) global partition by hash(k1) partitions 32;
create index k_2 on sbtest1(k2) global partition by hash(k2) partitions 32;

create database sbtest_gsi1;
use sbtest_gsi1;
CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL ,
`k` int(11) NOT NULL ,
`k1` int(11) NOT NULL ,
`k2` int(11) NOT NULL ,
`k3` int(11) NOT NULL ,
`k4` int(11) NOT NULL ,
`k5` int(11) NOT NULL ,
`k6` int(11) NOT NULL ,
`k7` int(11) NOT NULL ,
`k8` int(11) NOT NULL ,
`c` char(120) NOT NULL ,
`pad` char(60) NOT NULL ,
PRIMARY KEY (`id`)
) partition by hash(id)  partitions 32;
create index k_1 on sbtest1(k1) global partition by hash(k1) partitions 32;


create database sbtest_gsi0;
use sbtest_gsi0;
CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL ,
`k` int(11) NOT NULL ,
`k1` int(11) NOT NULL ,
`k2` int(11) NOT NULL ,
`k3` int(11) NOT NULL ,
`k4` int(11) NOT NULL ,
`k5` int(11) NOT NULL ,
`k6` int(11) NOT NULL ,
`k7` int(11) NOT NULL ,
`k8` int(11) NOT NULL ,
`c` char(120) NOT NULL ,
`pad` char(60) NOT NULL ,
PRIMARY KEY (`id`)
) partition by hash(id)  partitions 32;

OceanBase local index table creation statement

create database sbtest_local8;
use sbtest_local8;
CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL,
`k` int(11) NOT NULL ,
`k1` int(11) NOT NULL ,
`k2` int(11) NOT NULL ,
`k3` int(11) NOT NULL ,
`k4` int(11) NOT NULL ,
`k5` int(11) NOT NULL ,
`k6` int(11) NOT NULL ,
`k7` int(11) NOT NULL ,
`k8` int(11) NOT NULL ,
`c` char(120) NOT NULL ,
`pad` char(60) NOT NULL ,
PRIMARY KEY (`id`)
) partition by hash(id)  partitions 32;
create index k_1 on sbtest1(k1);
create index k_2 on sbtest1(k2);
create index k_3 on sbtest1(k3);
create index k_4 on sbtest1(k4);
create index k_5 on sbtest1(k5);
create index k_6 on sbtest1(k6);
create index k_7 on sbtest1(k7);
create index k_8 on sbtest1(k8);


create database sbtest_local4;
use sbtest_local4;

CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL,
`k` int(11) NOT NULL ,
`k1` int(11) NOT NULL ,
`k2` int(11) NOT NULL ,
`k3` int(11) NOT NULL ,
`k4` int(11) NOT NULL ,
`k5` int(11) NOT NULL ,
`k6` int(11) NOT NULL ,
`k7` int(11) NOT NULL ,
`k8` int(11) NOT NULL ,
`c` char(120) NOT NULL ,
`pad` char(60) NOT NULL ,
PRIMARY KEY (`id`)
) partition by hash(id)  partitions 32;
create index k_1 on sbtest1(k1);
create index k_2 on sbtest1(k2);
create index k_3 on sbtest1(k3);
create index k_4 on sbtest1(k4);


create database sbtest_local2;
use sbtest_local2;
CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL,
`k` int(11) NOT NULL ,
`k1` int(11) NOT NULL ,
`k2` int(11) NOT NULL ,
`k3` int(11) NOT NULL ,
`k4` int(11) NOT NULL ,
`k5` int(11) NOT NULL ,
`k6` int(11) NOT NULL ,
`k7` int(11) NOT NULL ,
`k8` int(11) NOT NULL ,
`c` char(120) NOT NULL ,
`pad` char(60) NOT NULL ,
PRIMARY KEY (`id`)
) partition by hash(id)  partitions 32;
create index k_1 on sbtest1(k1);
create index k_2 on sbtest1(k2);

create database sbtest_local1;
use sbtest_local1;
CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL ,
`k` int(11) NOT NULL ,
`k1` int(11) NOT NULL ,
`k2` int(11) NOT NULL ,
`k3` int(11) NOT NULL ,
`k4` int(11) NOT NULL ,
`k5` int(11) NOT NULL ,
`k6` int(11) NOT NULL ,
`k7` int(11) NOT NULL ,
`k8` int(11) NOT NULL ,
`c` char(120) NOT NULL ,
`pad` char(60) NOT NULL ,
PRIMARY KEY (`id`)
) partition by hash(id)  partitions 32;
create index k_1 on sbtest1(k1);


create database sbtest_local0;
use sbtest_local0;
CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL ,
`k` int(11) NOT NULL ,
`k1` int(11) NOT NULL ,
`k2` int(11) NOT NULL ,
`k3` int(11) NOT NULL ,
`k4` int(11) NOT NULL ,
`k5` int(11) NOT NULL ,
`k6` int(11) NOT NULL ,
`k7` int(11) NOT NULL ,
`k8` int(11) NOT NULL ,
`c` char(120) NOT NULL ,
`pad` char(60) NOT NULL ,
PRIMARY KEY (`id`)
) partition by hash(id)  partitions 32;

TiDB global index table creation statement

create database sbtest8;
use sbtest8;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`),
        KEY `k_3` (`k3`),
        KEY `k_4` (`k4`),
        KEY `k_5` (`k5`),
        KEY `k_6` (`k6`),
        KEY `k_7` (`k7`),
        KEY `k_8` (`k8`)
) ENGINE = InnoDB  DEFAULT CHARSET = utf8mb4;

create database sbtest4;
use sbtest4;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`),
        KEY `k_3` (`k3`),
        KEY `k_4` (`k4`)
) ENGINE = InnoDB  DEFAULT CHARSET = utf8mb4;


create database sbtest2;
use sbtest2;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`)
) ENGINE = InnoDB  DEFAULT CHARSET = utf8mb4;

create database sbtest1;
use sbtest1;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`)
) ENGINE = InnoDB  DEFAULT CHARSET = utf8mb4;


create database sbtest0;
use sbtest0;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`)
) ENGINE = InnoDB  DEFAULT CHARSET = utf8mb4;

TiDB global index table creation statement

create database sbtest8;
use sbtest8;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`),
        KEY `k_3` (`k3`),
        KEY `k_4` (`k4`),
        KEY `k_5` (`k5`),
        KEY `k_6` (`k6`),
        KEY `k_7` (`k7`),
        KEY `k_8` (`k8`)
) ENGINE = InnoDB  DEFAULT CHARSET = utf8mb4;

create database sbtest4;
use sbtest4;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`),
        KEY `k_3` (`k3`),
        KEY `k_4` (`k4`)
) ENGINE = InnoDB  DEFAULT CHARSET = utf8mb4;


create database sbtest2;
use sbtest2;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`)
) ENGINE = InnoDB  DEFAULT CHARSET = utf8mb4;

create database sbtest1;
use sbtest1;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`)
) ENGINE = InnoDB  DEFAULT CHARSET = utf8mb4;


create database sbtest0;
use sbtest0;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`)
) ENGINE = InnoDB  DEFAULT CHARSET = utf8mb4;

TiDB local index table creation statement

create database sbtest_local8;
use sbtest_local8;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`),
        KEY `k_3` (`k3`),
        KEY `k_4` (`k4`),
        KEY `k_5` (`k5`),
        KEY `k_6` (`k6`),
        KEY `k_7` (`k7`),
        KEY `k_8` (`k8`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 partition by hash(id)  partitions 32;

create database sbtest_local4;
use sbtest_local4;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
            `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`),
        KEY `k_3` (`k3`),
        KEY `k_4` (`k4`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 partition by hash(id) partitions 32;

create database sbtest_local2;
use sbtest_local2;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 partition by hash(id)  partitions 32;

create database sbtest_local1;
use sbtest_local1;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 partition by hash(id)  partitions 32;

create database sbtest_local0;
use sbtest_local0;
CREATE TABLE `sbtest1` (
        `id` bigint(11) NOT NULL AUTO_RANDOM,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 partition by hash(id)  partitions 32;

PolarDB-X global index table creation statement

drop database sbtest_gsi0;
drop database sbtest_gsi1;
drop database sbtest_gsi2;
drop database sbtest_gsi4;
drop database sbtest_gsi8;
create database sbtest_gsi8 mode=auto;
use sbtest_gsi8;
CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`),
        KEY `k_3` (`k3`),
        KEY `k_4` (`k4`),
        KEY `k_5` (`k5`),
        KEY `k_6` (`k6`),
        KEY `k_7` (`k7`),
        KEY `k_8` (`k8`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

create database sbtest_gsi4 mode=auto;
use sbtest_gsi4;
CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`),
        KEY `k_3` (`k3`),
        KEY `k_4` (`k4`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;


create database sbtest_gsi2 mode=auto;
use sbtest_gsi2;
CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`),
        KEY `k_2` (`k2`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

create database sbtest_gsi1 mode=auto;
use sbtest_gsi1;
CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k1`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;


create database sbtest_gsi0 mode=auto;
use sbtest_gsi0;
CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

PolarDB-X local index table building statement

drop database sbtest_local0;
drop database sbtest_local1;
drop database sbtest_local2;
drop database sbtest_local4;
drop database sbtest_local8;
create database sbtest_local8 mode=auto;
use sbtest_local8;
CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        LOCAL KEY `k_1` (`k1`),
        LOCAL KEY `k_2` (`k2`),
        LOCAL KEY `k_3` (`k3`),
        LOCAL KEY `k_4` (`k4`),
        LOCAL KEY `k_5` (`k5`),
        LOCAL KEY `k_6` (`k6`),
        LOCAL KEY `k_7` (`k7`),
        LOCAL KEY `k_8` (`k8`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

create database sbtest_local4 mode=auto;
use sbtest_local4;
CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        LOCAL KEY `k_1` (`k1`),
        LOCAL KEY `k_2` (`k2`),
        LOCAL KEY `k_3` (`k3`),
        LOCAL KEY `k_4` (`k4`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;


create database sbtest_local2 mode=auto;
use sbtest_local2;
CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        LOCAL KEY `k_1` (`k1`),
        LOCAL KEY `k_2` (`k2`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

create database sbtest_local1 mode=auto;
use sbtest_local1;
CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL DEFAULT '0',
                `k1` int(11) NOT NULL DEFAULT '0',
        `k2` int(11) NOT NULL DEFAULT '0',
        `k3` int(11) NOT NULL DEFAULT '0',
        `k4` int(11) NOT NULL DEFAULT '0',
        `k5` int(11) NOT NULL DEFAULT '0',
        `k6` int(11) NOT NULL DEFAULT '0',
        `k7` int(11) NOT NULL DEFAULT '0',
        `k8` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`),
        LOCAL KEY `k_1` (`k1`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;


create database sbtest_local0 mode=auto;
use sbtest_local0;
CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL DEFAULT '0',
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

CockroachDB global index table building statement

drop database sbtest1 CASCADE;
drop database sbtest2 CASCADE;
drop database sbtest4 CASCADE;
drop database sbtest8 CASCADE;

create database sbtest0;
use sbtest0;
CREATE TABLE sbtest1 (
        id UUID NOT NULL DEFAULT gen_random_uuid(),
        k int NOT NULL ,
                k1 int NOT NULL ,
        k2 int NOT NULL ,
        k3 int NOT NULL ,
        k4 int NOT NULL ,
        k5 int NOT NULL ,
        k6 int NOT NULL ,
        k7 int NOT NULL ,
        k8 int NOT NULL ,
        c char(120) NOT NULL ,
        pad char(60) NOT NULL,
        PRIMARY KEY (id)
);

create database sbtest1;
use sbtest1;
CREATE TABLE sbtest1 (
        id UUID NOT NULL DEFAULT gen_random_uuid(),        
                k int NOT NULL ,
                k1 int NOT NULL ,
        k2 int NOT NULL ,
        k3 int NOT NULL ,
        k4 int NOT NULL ,
        k5 int NOT NULL ,
        k6 int NOT NULL ,
        k7 int NOT NULL ,
        k8 int NOT NULL ,
        c char(120) NOT NULL ,
        pad char(60) NOT NULL,
        PRIMARY KEY (id),
                INDEX k_1(k1)
);

create database sbtest2;
use sbtest2;
CREATE TABLE sbtest1 (
        id UUID NOT NULL DEFAULT gen_random_uuid(),
        k int NOT NULL ,
                k1 int NOT NULL ,
        k2 int NOT NULL ,
        k3 int NOT NULL ,
        k4 int NOT NULL ,
        k5 int NOT NULL ,
        k6 int NOT NULL ,
        k7 int NOT NULL ,
        k8 int NOT NULL ,
        c char(120) NOT NULL ,
        pad char(60) NOT NULL,
        PRIMARY KEY (id),
                INDEX k_1(k1),
                INDEX k_2(k2)
);

create database sbtest4;
use sbtest4;
CREATE TABLE sbtest1 (
        id UUID NOT NULL DEFAULT gen_random_uuid(),
        k int NOT NULL ,
                k1 int NOT NULL ,
        k2 int NOT NULL ,
        k3 int NOT NULL ,
        k4 int NOT NULL ,
        k5 int NOT NULL ,
        k6 int NOT NULL ,
        k7 int NOT NULL ,
        k8 int NOT NULL ,
        c char(120) NOT NULL ,
        pad char(60) NOT NULL,
        PRIMARY KEY (id),
                INDEX k_1(k1),
                INDEX k_2(k2),
                INDEX k_3(k3),
                INDEX k_4(k4)
);

create database sbtest8;
use sbtest8;
CREATE TABLE sbtest1 (
        id UUID NOT NULL DEFAULT gen_random_uuid(),
        k int NOT NULL ,
                k1 int NOT NULL ,
        k2 int NOT NULL ,
        k3 int NOT NULL ,
        k4 int NOT NULL ,
        k5 int NOT NULL ,
        k6 int NOT NULL ,
        k7 int NOT NULL ,
        k8 int NOT NULL ,
        c char(120) NOT NULL ,
        pad char(60) NOT NULL,
        PRIMARY KEY (id),
            INDEX k_1(k1),
            INDEX k_2(k2),
            INDEX k_3(k3),
            INDEX k_4(k4),
            INDEX k_5(k5),
            INDEX k_6(k6),
            INDEX k_7(k7),
            INDEX k_8(k8)
);

Tags: Database MySQL PostgreSQL

Posted by jamesm87 on Sat, 03 Sep 2022 21:34:00 +0530