Giter Club home page Giter Club logo

uuid-storage-test's Introduction

Schema


CREATE DATABASE uuidtest;

USE uuidtest;

CREATE TABLE `users` (
  `id` varchar(36) NOT NULL,
  `created` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `users_num` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `created` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Running

Configure in the file the desired batch size and number of inserts, the database connection, and then run

node index.js

Running mysql in docker (local port 3308)

docker run -p 3308:3306 --name mysql-latest -e MYSQL_ROOT_PASSWORD=toor -d mysql:latest  --default-authentication-plugin=mysql_native_password

Results

Total: Total miliseconds took
Avg: Average milisecond duration per batch
batchSize: How many rows inserts each batch
Batches: How many batches were ran
Rows: Total rows inserted

Mysql 5.6:

Uuid result: { 
  total: 10995,
  avg: 2.199,
  batchSize: 50,
  batches: 5000,
  rows: 250000 }
Numeric result: { 
  total: 9013,
  avg: 1.8026,
  batchSize: 50,
  batches: 5000,
  rows: 250000 }


Uuid result: { 
 total: 500366,
  avg: 10.00732,
  batchSize: 50,
  batches: 50000,
  rows: 2500000 }
Numeric result: {
  total: 131499,
  avg: 2.62998,
  batchSize: 50,
  batches: 50000,
  rows: 2500000 }


Uuid result: {
  total: 1620982,
  avg: 32.41964,
  batchSize: 100,
  batches: 50000,
  rows: 5000000 }
Numeric result: { 
  total: 214456,
  avg: 4.28912,
  batchSize: 100,
  batches: 50000,
  rows: 5000000 }


Uuid result: { 
  total: 1614770,
  avg: 64.5908,
  batchSize: 200,
  batches: 25000,
  rows: 5000000 }
Numeric result: { 
  total: 154715,
  avg: 6.1886,
  batchSize: 200,
  batches: 25000,
  rows: 5000000 }

Mysql 8.0.18:

Uuid result: { 
  total: 23539,
  avg: 4.7078,
  batchSize: 50,
  batches: 5000,
  rows: 250000 }
Numeric result: {
  total: 21264,
  avg: 4.2528,
  batchSize: 50,
  batches: 5000,
  rows: 250000 }


Uuid result: {
  total: 380339,
  avg: 7.60678,
  batchSize: 50,
  batches: 50000,
  rows: 2500000 }
Numeric result: {
  total: 247198,
  avg: 4.94396,
  batchSize: 50,
  batches: 50000,
  rows: 2500000 }

Uuid result: { 
  total: 959457,
  avg: 19.18914,
  batchSize: 100,
  batches: 50000,
  rows: 5000000 }
Numeric result: { 
  total: 407903,
  avg: 8.15806,
  batchSize: 100,
  batches: 50000,
  rows: 5000000 }

Uuid result: {
  total: 872368,
  avg: 34.89472,
  batchSize: 200,
  batches: 25000,
  rows: 5000000 }
Numeric result: { 
  total: 346356,
  avg: 13.85424,
  batchSize: 200,
  batches: 25000,
  rows: 5000000 }

Misc:

Reading the comments on https://mysqlserverteam.com/mysql-8-0-uuid-support/, it looks like using those function the performance would be the same as using numbers, the main problem is that no ORM handles the MYSQL uuid functions, and the MySQL team answered there saying they may implement it as a Data Type in the future.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.