‘The Legend of Zelda: Tears of the Kingdom’ lands on Switch May 12th, 2023

http://img.youtube.com/vi/2SNF4M_v7wc/0.jpg

The sequel to The Legend of Zelda: Breath of the Wild is called Tears of the Kingdom and it’s due to hit Switch on May 12th, 2023. Nintendo revealed the release date, name and a short teaser for the game during today’s Direct showcase. The studio says Tears of the Kingdom will travel into the skies beyond Hyrule, to an expanded world among the clouds.

The Legend of Zelda: Breath of the Wild debuted in 2017, the same day the Switch came to market. It was a huge critical and commercial success, and the sequel has been hotly anticipated since. The new game was originally announced with a release window in 2022, but in March, Nintendo delayed it into spring 2023.

It wasn’t the only major game to be pushed out of 2022. A handful of titles from big publishers, including Starfield, Redfall, Hogwarts Legacy and Forspoken, were delayed into 2023 this year.

Engadget

Taurus TX22 Competition Review: Best Budget Competition Pistol?

https://www.pewpewtactical.com/wp-content/uploads/2022/09/title-1.jpg

Taurus is known for making affordable, dependable guns. Yes, they’ve had their hiccups, but I believe those days are behind us.

Taurus TX22 Targets
The red dot sight is not included with the gun, but the muzzle compensator is included in the box.

The company’s new TX22 has recently been issued in competition finery, with a relieved slide, 4-pound trigger, threaded barrel, and optics-ready slide.

But does this budget-friendly pistol really stack up on the stages? We’re going to walk you through the pros, cons, specs, and features to let you know.

So keep reading!

Table of Contents

Loading…

Taurus TX22 Competition Review at a Glance

Pros

  • The gun reliably spits lead with every pull of the trigger and shucked the empties clear.
  • You get three 16-round mags with loading pull-down tabs.
  • An optics base plate is installed at the factory, and adapter plates allow different red dot sights to be mounted.

Cons

  • Grip texturing is fairly non-existent, and the grip feels slippery.
  • The MSRP of $533 seems a bit pricy for a Taurus .22, even with the included accessories.
  • One of the included mags was missing its round pull-down tab that allows quick loading. The mag was still functional, but this was a QC miss.

The Bottom Line

Taurus TX22

For a street price of around $450, you get three 16-round mags, a red dot-ready slide, a muzzle compensator, and a very nice trigger. Add in the lightened slide, adjustable rear sight, plus locked-in reliability and accuracy, and you have a winner, winner chicken dinner!

Available Coupons

Specs & Features

Specs

  • Width: 1.25”
  • Length: 8.15”
  • Barrel Length: 5.25”
  • Height: 5.44”
  • Weight: 23.2 oz.
  • Capacity: 16+1
  • MSRP: $533

Features

  • Threaded barrel with standard 1/2×28 threads for a compensator or suppressor
  • Fully Adjustable Rear Sight
  • Reversible Magazine Release

Source: Taurus

Background

The .22 handgun field is crowded. From super-expensive tack-driving target guns like the Smith & Wesson 41 to inexpensive plinkers like the Heritage Rough Rider, you can get just about whatever you desire in a rimfire pistol or revolver.

Regardless of whether you get a model with a manual safety or not, the TX22 does not have a Glock-style trigger safety blade.

In terms of pistols set up for competition, Taurus is a new player in the game.

The TX22 has been a steady seller for Taurus since its introduction. What sets the gun apart from most of its competition is reliability, accuracy, and capacity.

I mean, what other accurate .22 pistol holds 17 rounds and sells for what this pistol costs? There might be some out there, but Taurus seems to have nailed it with this gun. This is a company with its proverbial ear to the ground, listening to shooters and trying to supply our needs.

It may be a bit of a weird way to mount an optic, but having it secured to the barrel seems to work.

They decided to make a TX22 for competitors, so they modified the stock model and added some excellent features. Taurus’s recent releases seem to have been well received, and the TX22 Competition is no exception.

Who Is It For?

This Competition model is geared toward rimfire competitors. I know, duh…but it also is made for the casual shooter who may want to take their rimfire game to the next level.

You can easily customize this pistol.

On the Taurus Store, there are over 40 items you can buy for the TX22. This means that most shooters, from beginners to seasoned veterans, can modify the gun to fit their needs.

Taurus TX22 Compensator
The Pro Squared Game Changer muzzle brake reduces the already low recoil of .22LR down to near zero.

Another segment of the shooting market I should mention is the small-game hunters out there, of which I am one. The TX22, with its adjustable rear sight or a red dot, would make a great squirrel-getter.

Overall, it is an extremely versatile pistol.

What’s In The Box?

In addition to the pistol, you have three magazines, two red dot adapter plates, the muzzle compensator with O-ring, a washer and barrel thread protector, a magazine loader, a lock, and a manual. The case is a hinged, hard-plastic type that is better than previous Taurus boxes.

Taurus TX22 Contents
Everything that is in the box with the TX22 Competition.

Fit & Feel

The gun felt like a full-size 9mm in my hand, except for the weight. It is pretty light, even with a full magazine and a red dot installed.

The grip texture is not very aggressive.

The only issue I had with it concerned the lack of grip texture. Now, I get it – I assume Taurus figures that this gun is “just” a .22 and won’t recoil like its brethren with larger holes in their barrels. They probably figure that a less-textured grip surface is OK and won’t rub new shooters the wrong way (literally).

If you are like me and prefer a more aggressive grip texture, this gun doesn’t have it. The first thing I’d do is plug in my trusty soldering iron and stipple the snot out of it or add some Talon Grips.

As for sights, they don’t co-witness, so the plain-ordinary-white-dot-ness isn’t much of a factor for red dot shooters. At least the rear sight is adjustable.

Taurus TX22 Top
The optics plate is mounted directly to the top of the barrel, which means the sight does not reciprocate with the slide.

How Does It Shoot?

I took the gun to my backyard range and grabbed three boxes of .22 ammo — Remington Thunderbolt, Winchester Wildcat 40-grain HP, and Aguila 40-grain target.

I installed my TruGlo Tru-Tec micro red dot on the gun for shooting.

The grouping at 20 yards with Remington Thunderbolt ammo.

It shot mostly low, so I used a high/right aiming point for the Remington. The other two allowed me to use a center hold on the orange dot and still keep the shots on the paper, about 2 inches low.

The Remington Thunderbolt spread itself a bit. Depending on the gun, this load is either very accurate or not at all.

The TX22 is somewhere in the middle…

The group at 20 yards with Winchester Wildcat 40-grain ammo.

The Winchester and Aguila loads allowed the use of the center orange “dot” as an aiming point. Windage was right on, but the elevation was low.

TX22 Aguila Target
The group at 20 yards with Aguila Target 40 grain ammo.

As you can see, the gun would be worth working with to find that perfect load for it.

I only tried three, but it is well known that .22 ammo varies widely in its accuracy potential with different guns. If I had more time with this pistol, I’d try some CCI 40-grain standard and high-velocity loads, but the potential is there.

What Sets it Apart?

Why would you buy this TX22 when there are other capable .22 pistols in the same price range or less?

From my perspective, it feels different in my hand than S&W Victory. The grip offers a more “Glock-like” feel…like a full-size striker 9mm than most other .22s I’ve handled or shot.

A non-reciprocating optic and a muzzle brake are not things you normally find on a gun under $500.

The frame is very close to that used on the TH line of Taurus guns and also is close to the G3 series frames.

You could practice with the TX22, then go to your bigger blaster without much fuss. My Victory or my Diamondback Sidekick can’t do that.

By The Numbers

Reliability: 5/5

It shot whatever I put through it.

Ergonomics: 4/5

The slick grip makes it a 4, not a 5.

Accuracy: 5/5

No problems here!

Customization: 5/5

The Taurus Store and many other vendors have you covered here with plenty of accessories to add on.

Value: 4/5

Its street price of ~$450 is a bit steep, but if you want to keep it under $500, it will do.

Overall: 4.5/5

Available Coupons

Upgrades for the TX22 Competition

The Taurus Store is a great place to start for accessories, but a quick search will turn up a bunch of other vendors that should scratch your TX22 modification itch.

How about a raised, red competition magazine release? Tandemkross sells one.

If you own a standard TX22, you can buy a Competition model conversion kit for a few more dollars. That gets you the slide, barrel, and recoil spring of the Competition model. It’s a simple plug-and-play setup.

143

at Tandemkross

Prices accurate at time of writing

Prices accurate at time of writing

Available Coupons

Final Verdict

To sum up, the .22 pistol market has just happily expanded, and the Taurus TX22 Competition pistol is a great addition to the neighborhood.

Taurus TX22 Right
Taurus has come a long way with its innovation and quality control in the last few years. The result? Guns like the TX22 and GX4.

From its threaded muzzle, a great trigger, versatile optics base plate & adapters to its lightened slide and adjustable rear sight, the Comp has a lot going for it.

I wouldn’t hesitate for an instant to add this gun to my gun cabinet, and I don’t think you should, either.

What do you think of the Taurus TX22 Competition? Let us know below. Interested in the regular TX22 or .22 LR guns in general? Check out our article on the Best .22 LR Training Guns.

The post Taurus TX22 Competition Review: Best Budget Competition Pistol? appeared first on Pew Pew Tactical.

Pew Pew Tactical

Laravel Telescope: Important Helpful Tool You Need to Know More About

https://hashnode.com/utility/r?url=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1662646398500%2FKTlIM8Jdp.png%3Fw%3D1200%26h%3D630%26fit%3Dcrop%26crop%3Dentropy%26auto%3Dcompress%2Cformat%26format%3Dwebp%26fm%3Dpng

As developers, debugging apps is the task we do most of the time, and the essential part of it is accessing debug information, knowing what’s happening under the hood like seeing what queries are executed, knowing what commands are executed by your Laravel application will help you a lot to debug your application, and this is exactly what Laravel Telescope can do for you.

Laravel Telescope

What is Laravel Telescope

Laravel Telescope is a first party Laravel package, its creators described it as:

An elegant debug assistant for the Laravel framework.

And this is exactly what it is, it’s your assistant while developing and debugging Laravel applications, it collects the important things you need to have an eye on like requests, database queries, queued jobs… basically everything’s happening in your application in one beautiful place so you can access them easily.

Laravel Telescope can also be helpful while improving the performance of your application, for example using its Queries feature that shows you all the database queries that are executed on every request, such thing can, for example, help you identify repetitive and unnecessary queries and fix them.

Laravel Telescope Installation

You can install it easily as any other Laravel package via composer:

composer require laravel/telescope

After installing it, you can publish its assets using the following command:

php artisan telescope:install

Finally, you have to run migrations to create the tables needed by Laravel Telescope:

php artisan migrate

That’s it, to access Laravel Telescope’s dashboard and start using it, visit /telescope.

Laravel Telescope in the Production environment

Now this dashboard is accessible only in the Local environment, if you try to access it in the Production environment, you will get a 403 FORBIDDEN error and that’s because of the authorization gate defined in app/Providers/TelescopeServiceProvider.php and that’s for sure a good thing, you don’t want to let everyone access Laravel Telescope’s dashboard.

Laravel Telescope 403 FORBIDDEN

To access the dashboard in a Production environment, edit the authorization gate in the way you want it to be, for example:

app/Providers/TelescopeServiceProvider.php

protected function gate()
    {
        Gate::define('viewTelescope', function ($user) {
            return in_array($user->email, [
                'your@email.com'
            ]);
        });
    }

Or maybe by users ID:

protected function gate()
    {
        Gate::define('viewTelescope', function ($user) {
            return in_array($user->id, [
                1,
            ]);
        });
    }

For more information about Laravel Telescope, visit the official documentation.

Here is their official repository on GitHub.

Laravel News Links

Remove Sensitive Information from Laravel Apps

https://laravelnews.imgix.net/images/laravel-scrubber-featured.png?ixlib=php-3.3.1

Laravel Scrubber is a Laravel package to scrub sensitive information that breaks operational security policies from being leaked on accident or not by developers.

You can use this package in a few ways:

First, this package detects log messages and context patterns and scrubs them:

1Log::info('some message', [

2 'context' => 'accidental',

3 'leak_of' => [

4 'jwt' => '<insert jwt token here>'

5 ]

6]);

7 

8// testing.INFO: some message {"context":"accidental","leak_of":{"jwt": '**redacted**'}}

9 

10Log::info('<insert jwt token here>');

11 

12// testing.INFO: **redacted**

Second, you can use the scrubber directly to process data in an array and mark it as redacted:

1Scrubber::processMessage([

2 'context' => 'accidental',

3 'leak_of' => [

4 'jwt' => '<insert jwt token here>'

5 ]

6]);

7 

8// [

9// "context" => "accidental"

10// "leak_of" => [

11// "jwt" => "**redacted**"

12// ]

13// ];

14 

15Scrubber::processMessage('<insert jwt token here>');

16// **redacted**

This package also provides customization options, such as configuring the replacement message when data is scrubbed (the default is **redacted**). You can also extend the package by adding custom regex scrubbers.

You can start with Laravel Scrubber by checking out the project on GitHub at YorCreative/Laravel-Scrubber.

Laravel News

MySQL & UUIDs

More and more people are using UUID’s to identify records in their database.

As you already know, for MySQL’s storage engine (InnoDB) the primary key is very important ! (for performance, memory and disk space).

See the following links:

Problems

There are 2 major problems having a UUID as Primary Key in InnoDB:

  1. generally they are random and cause clustered index to be rebalanced
  2. they are included in each secondary indexes (consuming disk and memory)

Let’s have a look at this example:

MySQL > CREATE TABLE my_table ( 
       uuid VARCHAR(36) DEFAULT (UUID()) PRIMARY KEY, 
       name VARCHAR(20), beers int unsigned);
...

MySQL > SELECT * FROM my_table;
+--------------------------------------+---------+-------+
| uuid                                 | name    | beers |
+--------------------------------------+---------+-------+
| 17cd1188-1fa0-11ed-ba36-c8cb9e32df8e | Kenny   |     0 |
| 17cd12e2-1fa0-11ed-ba36-c8cb9e32df8e | lefred  |     1 |
| 478368a0-1fa0-11ed-ba36-c8cb9e32df8e | Scott   |     1 |
| 47836a77-1fa0-11ed-ba36-c8cb9e32df8e | Lenka   |     0 |
+--------------------------------------+---------+-------+

Now, let’s insert 2 new records:

MySQL > INSERT INTO my_table (name, beers) VALUES ("Luis",1), ("Miguel",5);

We can check the content of the table:

MySQL > SELECT * FROM my_table;
+--------------------------------------+---------+-------+
| uuid                                 | name    | beers |
+--------------------------------------+---------+-------+
| 17cd1188-1fa0-11ed-ba36-c8cb9e32df8e | Yannis  |     0 |
| 17cd12e2-1fa0-11ed-ba36-c8cb9e32df8e | lefred  |     1 |
| 36f1ce9a-1fa1-11ed-ba36-c8cb9e32df8e | Luis    |     1 |  <--
| 36f1d158-1fa1-11ed-ba36-c8cb9e32df8e | Miguel  |     5 |  <--
| 478368a0-1fa0-11ed-ba36-c8cb9e32df8e | Scott   |     1 |
| 47836a77-1fa0-11ed-ba36-c8cb9e32df8e | Lenka   |     0 |
+--------------------------------------+---------+-------+

We can see that the two new records were not inserted at the end of the table but in the middle. InnoDB had to move two old records to be able to insert the two new before them. On such small table (all records are on the same page) that doesn’t cause any problem, but imagine this table is 1TB large !

Additionally, if we keep the VARCHCAR datatype for our uuid, the primary key could take 146 bytes per row (some utf8 characters can take up to 4 bytes + the 2 bytes marking the end of the VARCHAR):

MySQL > EXPLAIN SELECT * FROM my_table WHERE 
        uuid='36f1d158-1fa1-11ed-ba36-c8cb9e32df8e'\G
 *************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: my_table
   partitions: NULL
         type: const
possible_keys: PRIMARY
          key: PRIMARY
      key_len: 146        <--
          ref: const
         rows: 1
     filtered: 100
        Extra: NULL

Solutions

Of course there are some best practices that MySQL users can follow to avoid those problems:

  1. use a smaller datatype to store their UUIDs: BINARY(16)
  2. store the UUIDs sequentially: use UUID_TO_BIN(..., swap_flag)
    • The time-low and time-high parts (the first and third groups of hexadecimal digits, respectively) are swapped.

Let’s see this in action with the following example:

MySQL > CREATE TABLE my_table2 ( 
           uuid BINARY(16) DEFAULT (UUID_TO_BIN(UUID(), 1)) PRIMARY KEY, 
           name VARCHAR(20), beers int unsigned);

MySQL > SELECT * FROM my_table2;
+------------------------------------+--------+-------+
| uuid                               | name   | beers |
+------------------------------------+--------+-------+
| 0x11ED1F9F633ECB6CBA36C8CB9E32DF8E | Kenny  |     0 |
| 0x11ED1F9F633ECD6FBA36C8CB9E32DF8E | lefred |     1 |
+------------------------------------+--------+-------+

As the UUID is now binary, we need to decode it using the function BIN_TO_UUID() and not forget the swap flag:

MySQL > SELECT BIN_TO_UUID(uuid,1), name, beers FROM my_table2;
+--------------------------------------+--------+-------+
| BIN_TO_UUID(uuid,1)                  | name   | beers |
+--------------------------------------+--------+-------+
| 633ecb6c-1f9f-11ed-ba36-c8cb9e32df8e | Kenny  |     0 |
| 633ecd6f-1f9f-11ed-ba36-c8cb9e32df8e | lefred |     1 |
+--------------------------------------+--------+-------+

And now we can verify that when we add new entries they are added to the end of the table:

MySQL > INSERT INTO my_table2 (name, beers) VALUES ("Scott",1), ("Lenka",5); 

MySQL > SELECT * FROM my_table2;
+------------------------------------+---------+-------+
| uuid                               | name    | beers |
+------------------------------------+---------+-------+
| 0x11ED1F9F633ECB6CBA36C8CB9E32DF8E | Kenny   |     0 |
| 0x11ED1F9F633ECD6FBA36C8CB9E32DF8E | lefred  |     1 |
| 0x11ED1FA537C57361BA36C8CB9E32DF8E | Scott   |     1 |  <--
| 0x11ED1FA537C5752DBA36C8CB9E32DF8E | Lenka   |     5 |  <--
+------------------------------------+---------+-------+

and we can of course decode the UUID and see that without the swap flag, InnoDB would have to rebalance the clustered index:

MySQL > SELECT BIN_TO_UUID(uuid,1), name, beers FROM my_table2;
+--------------------------------------+---------+-------+
| BIN_TO_UUID(uuid,1)                  | name    | beers |
+--------------------------------------+---------+-------+
| 633ecb6c-1f9f-11ed-ba36-c8cb9e32df8e | Kenny   |     0 |
| 633ecd6f-1f9f-11ed-ba36-c8cb9e32df8e | lefred  |     1 |
| 37c57361-1fa5-11ed-ba36-c8cb9e32df8e | Scott   |     1 |  <--
| 37c5752d-1fa5-11ed-ba36-c8cb9e32df8e | Lenka   |     5 |  <--
+--------------------------------------+---------+-------+

And of course, now the size of the primary key is smaller and fixed to 16 bytes. Only those 16 bytes are added to all secondary indexes:

MySQL > EXPLAIN SELECT * FROM my_table2 
        WHERE uuid=UUID_TO_BIN("37c5752d-1fa5-11ed-ba36-c8cb9e32df8e",1)\G
 *************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: my_table2
   partitions: NULL
         type: const
possible_keys: PRIMARY
          key: PRIMARY
      key_len: 16        <---
          ref: const
         rows: 1
     filtered: 100
        Extra: NULL

UUID v1

MySQL generates UUID v1 as described in RFC4122.

  • UUID v1 : is a universally unique identifier that is generated using a timestamp and the MAC address of the computer on which it was generated.
  • UUID v4 : is a universally unique identifier that is generated using random numbers.

With UUID v4m it’s not possible to generate any sequential ouput and this is why those random UUID should never be used as Primary Key with InnoDB.

UUID v4

Some developers keep asking about UUIDv4 and how to generate them for MySQL. Browsing the Internet, you can find several store procedures trying to achieve this.

This one, found on StackOverflow, is maybe my favorite:

CREATE FUNCTION uuid_v4s()
    RETURNS CHAR(36)
BEGIN
    -- 1th and 2nd block are made of 6 random bytes
    SET @h1 = HEX(RANDOM_BYTES(4));
    SET @h2 = HEX(RANDOM_BYTES(2));

    -- 3th block will start with a 4 indicating the version, remaining is random
    SET @h3 = SUBSTR(HEX(RANDOM_BYTES(2)), 2, 3);

    -- 4th block first nibble can only be 8, 9 A or B, remaining is random
    SET @h4 = CONCAT(HEX(FLOOR(ASCII(RANDOM_BYTES(1)) / 64)+8),
                SUBSTR(HEX(RANDOM_BYTES(2)), 2, 3));

    -- 5th block is made of 6 random bytes
    SET @h5 = HEX(RANDOM_BYTES(6));

    -- Build the complete UUID
    RETURN LOWER(CONCAT(
        @h1, '-', @h2, '-4', @h3, '-', @h4, '-', @h5
    ));
END

Unfortunately this function cannot be used as default expression for a column.

I also wrote a component using boost’s uuid library: https://github.com/lefred/mysql-component-uuid_v4

But this new function is also not usable as default value expression.

MySQL error code MY-003770 (ER_DEFAULT_VAL_GENERATED_NAMED_FUNCTION_IS_NOT_ALLOWED): Default value expression of column '%s' contains a disallowed function: %s.

This means that every new record needs to provide the uuid column… this is not too complicated anyway.

Let’s see an example:

MySQL > install component "file://component_uuid_v4";

MySQL > select uuid_v4() ;
+--------------------------------------+
| uuid_v4()                            |
+--------------------------------------+
| 9944272b-e3f9-4778-9c54-818f0baa87da |
+--------------------------------------+
1 row in set (0.0002 sec)

Now we will create a new table, but as recommended, we won’t use the uuid as Primary Key ! We will use a new feature of MySQL 8.0.30: GIPK Mode !

GIPK stands for Generated Invisible Primary Key, check the manual for more info.

MySQL > SET sql_generate_invisible_primary_key=1;
 
MySQL > CREATE TABLE my_table3 (   
            uuid BINARY(16) NOT NULL UNIQUE,
            name VARCHAR(20), beers INT UNSIGNED);

MySQL > SHOW CREATE TABLE my_table3\G
*************************** 1. row ***************************
       Table: my_table3
Create Table: CREATE TABLE `my_table3` (
  `my_row_id` bigint unsigned NOT NULL AUTO_INCREMENT /*!80023 INVISIBLE */,
  `uuid` binary(16) NOT NULL,
  `name` varchar(20) DEFAULT NULL,
  `beers` int unsigned DEFAULT NULL,
  PRIMARY KEY (`my_row_id`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

Now let’s insert some records and see if they are inserted sequentially and if the UUID’s value is completely random:

MySQL > INSERT INTO my_table3 (uuid, name, beers) 
        VALUES (UUID_TO_BIN(uuid_v4()),'Kenny', 3),
               (UUID_TO_BIN(uuid_v4()), 'lefred', 1);

MySQL > SELECT * FROM my_table3;
+------------------------------------+--------+-------+
| uuid                               | name   | beers |
+------------------------------------+--------+-------+
| 0x5A28E5482CDF4B3D89A298ECA3F3703B | Kenny  |     3 |
| 0x94662BF4DC2F469489D868820B7B31E5 | lefred |     1 |
+------------------------------------+--------+-------+

MySQL > SELECT BIN_TO_UUID(uuid), name, beers FROM my_table3;
+--------------------------------------+--------+-------+
| bin_to_uuid(uuid)                    | name   | beers |
+--------------------------------------+--------+-------+
| 5a28e548-2cdf-4b3d-89a2-98eca3f3703b | Kenny  |     3 |
| 94662bf4-dc2f-4694-89d8-68820b7b31e5 | lefred |     1 |
+--------------------------------------+--------+-------+

So far, so good.. let’s add some more records:

MySQL > INSERT INTO my_table3 (uuid, name, beers) 
        VALUES (UUID_TO_BIN(uuid_v4()),'Scott', 10), 
               (UUID_TO_BIN(uuid_v4()), 'Lenka', 0);

MySQL > SELECT BIN_TO_UUID(uuid), name, beers FROM my_table3;
+--------------------------------------+--------+-------+
| bin_to_uuid(uuid)                    | name   | beers |
+--------------------------------------+--------+-------+
| 5a28e548-2cdf-4b3d-89a2-98eca3f3703b | Kenny  |     3 |
| 94662bf4-dc2f-4694-89d8-68820b7b31e5 | lefred |     1 |
| 615fae32-d6c8-439c-9520-5d3c8bfa934b | Scott  |    10 |
| 80a01a29-489b-419d-bca1-05a756ad9d9d | Lenka  |     0 |
+--------------------------------------+--------+-------+

We can see that indeed, the UUIDs are completely random and sequentially added to the table. The reason of that optimal sequential insertion is that the invisible Primary Key is an auto_increment.

It’s possible to also display it on demand:

MySQL > SELECT my_row_id, BIN_TO_UUID(uuid), name, beers FROM my_table3;
+-----------+--------------------------------------+--------+-------+
| my_row_id | bin_to_uuid(uuid)                    | name   | beers |
+-----------+--------------------------------------+--------+-------+
|         1 | 5a28e548-2cdf-4b3d-89a2-98eca3f3703b | Kenny  |     3 |
|         2 | 94662bf4-dc2f-4694-89d8-68820b7b31e5 | lefred |     1 |
|         3 | 615fae32-d6c8-439c-9520-5d3c8bfa934b | Scott  |    10 |
|         4 | 80a01a29-489b-419d-bca1-05a756ad9d9d | Lenka  |     0 |
+-----------+--------------------------------------+--------+-------+

Conclusion

In summary, if you want to use UUID’s in MySQL, it’s recommended to use UUID v1, those generated by MySQL, and store them as binary using the swap flag.

If for some reason you need UUID v4, it is recommended to let MySQL and InnoDB handle the primary key by enabling GIPK mode.

Enjoy MySQL !

Planet MySQL

MySQL Window Functions Part 2

Window functions in MySQL offer developers an efficient way to view and compare data across a result set. In this post we will talk about using aggregate functions as window functions and break down the different sections of a window frame.Planet MySQL

How to Setup a LAMP Stack with MySQL HeatWave – Part 3/5

Whilst not part of the LAMP stack per-se, you will need a MySQL client in order to be able to upload and make changes to your database schema. MySQL clients that could be used include: the traditional MySQL client; MySQL shell; MySQL Workbench as well as phpMyAdmin. At the stage the most efficient of these clients will be MySQL Shell.Planet MySQL