https://media.notthebee.com/articles/d586ac7a-2764-49ad-b2f2-96b98d98000d.jpg
Take it away, cheeky British person:
Not the Bee
Just another WordPress site
https://media.notthebee.com/articles/d586ac7a-2764-49ad-b2f2-96b98d98000d.jpg
Take it away, cheeky British person:
Not the Bee
https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2021/03/Slack-Header.jpg
Are you really a startup if you don’t use Slack? It’s a question that’s been asked before. Startups, specifically tech startups as that’s what this article is about, often use particular software and tools to make life easier for the team and day-to-day running of the business.
If you are a startup that’s looking to improve its work efficiency, consider using one or more of the tools listed below.
There is an abundance of software and tools on the market for startups to use. There’s no way we’re going to be able to look at them all in any kind of article. So, to consider some software as examples, these are some of the tools that are most commonly used.

Slack is one of the most common tools in the tech world. Everybody uses Slack from startups to YouTube teams.
The tool is for communication within your organization. Slack works as a channel-based messaging platform for organizations to use in order to improve communications. You can direct message other team members, and send messages to larger groups.
Related: What Is Slack and How Does It Work?
The tool is perfect for making it easy to talk to teams and staff instantly, without the need for emails. Slack also supports the integration of other software and tools so that you can have all of your workplace tools in one space.
For example, you can integrate your calendar so you can send reminders in messages about upcoming events or meetings. You can even integrate services like Google Drive to create Google Docs without leaving your Slack workspace.

Asana is a team and task management tool. Using the platform, you put tasks on To-Do lists for different teams. From here, you can assign tasks to certain team members, and set deadlines as well.
The tool makes it much easier for teams and management to keep on top of projects and tasks so that there’s less need for catch-ups. Reporting tools on Asana make it easy to see exactly what your teams have been getting up to, as well as the to-do list style making it easy for team members to keep track of their tasks.

Monday is another task management tool. The platform offers a very simple yet effective solution to task management. There are plenty of reasons that teams use Monday.
Uploading tasks in a to-do list style makes it easy to break larger projects down into smaller tasks. Monday uses a color-based status to monitor the progress of tasks with just a glance. The platform also allows for integrations with other tools to bring tasks directly to you without the need for manual input, saving time.

Intercom is one of the most popular live chat platforms for companies to use on their website. Most websites use live chat now as it’s a quicker and more convenient way for users to contact the support team.
This tool probably has some of the most customizable and intuitive features. Not only can you build a live chat system with automation and a bot, but you can also use Intercom to communicate via email, and build a FAQ page for your website.

Zendesk is one of the tools available that does the most for a company. The platform has an all-in-one feel to it, and can often be used to cover the whole of the customer services team.
With Zendesk, you can add live chat to your website, manage and ticket your emails, build and upload an in-depth FAQ page, manage phone calls, and manage social media. With all the important customer communication channels being brought under one roof, a team can respond to users faster than ever.

Google Workspace is the most comprehensive tool on this list. However, this is a platform that many users may not know a company actually uses.
The platform brings Google to your organization. Google Workspace allows you to create email accounts using your company’s domain name and turns these into private Google accounts.
Related: The Best Google Teamwork Tools for Online Collaboration
This gives you access to all the Google services such as Drive, Docs, Slides, Photos, and all the others while allowing the company to manage each account.
Many organizations use Google Workspace behind the scenes for their emails, and file storage on the cloud.
When it comes to how many startups use productivity tools, you’d probably argue that every startup does to one level or another. All startups use email at the very least, so their email client makes at least one tool that the company is using.
In terms of the list we’ve focused on in this article, all these tools are widely used by startups. Slack is used by 750,000 companies (2020), Asana by 50,000 (2018), Monday by 100,000 (2020), Intercom by 30,000+ (2021), Zendesk by 150,000 (2020), and G Suite by 6 million (2020). Across the board, the six tools we’ve looked at are used by approximately 7.1 million organizations.

And these six tools are just some of the most popular platforms out there. There are hundreds of other tools out there with high user numbers as well. So, when you consider this, inarguably you can see that so many startups really do use these tools.
Using or not using certain software cannot determine whether or not you are a startup company. The definition of a startup is "A newly established business".
If a company meets that definition, they are literally a startup. But, when you consider how integral many of these tools have become for startups, you must wonder what they’d do without them.
Ultimately, the tool that will be talked about is one that helps to increase their bottom line, improve the overall experience at work, and contribute to seamless team collaboration.
MUO – Feed
https://laravelnews.s3.amazonaws.com/images/spatie-dto-v3-featured.png
Spatie’s Data Transfer Object (DTO) package makes constructing objects from arrays a breeze, giving you confidence in the data contained therein. I’ve been a fan of this package since learning about the initial V1 release, and I hope you’ll consider this package for passing around data in your application.
The DTO package just released V3 with all of the PHP 8 goodies we’ve only dreamed of up to this point. For those just starting to use or consider PHP 8 in your projects, the source code of the V3 DTO package is an excellent resource with real-world examples of helpful PHP 8 features.
I want to congratulate the principal author Brent Roose and Spatie for moving forward with this excellent package with the features in the V3 release.
Here are some of the main features taken from the readme available in V3:
If you want all the details of the above features, check out the project’s readme.
While the DTO package readme delves into the more complex use-cases this package supports, here’s a simple example back from V1 of what you might expect from this package for those not familiar with the DTO package:
class PostData extends DataTransferObject
{
/** @var string */
public $title;
/** @var string */
public $body;
/** @var int */
public $author_id;
}
$postData = new PostData([
'title' => '…',
'body' => '…',
'author_id' => '…',
]);
$postData->title;
$postData->body;
$postData->author_id;
As you can see, we can pass array data to the constructor, which (at the time of V1) checks types at runtime and constructs a PostData instance or fails in an exception if the data is not valid.
With the release of typed properties in PHP 7.4 and named arguments and union types in PHP 8, Spatie’s V3 of the DTO package leverages many new language features. Taking the simple example above, here’s what it might look like in a PHP 8 version:
use Spatie\DataTransferObject\DataTransferObject;
class PostData extends DataTransferObject
{
public string $title;
public string $body;
public int $author_id;
}
// Named arguments FTW
$post = new PostData(
title: 'Hello World',
body: 'This is a test post.',
author_id: 1
);
echo $post->title, "\n";
echo $post->body, "\n";
echo $post->author_id, "\n";
The above example is simple but illustrates well how this package’s basics have evolved since V1, which supports PHP ^7.0. Note: given the above example, you might not even need to leverage the DTO package as PHP 8 takes care of the typing concerns and allows named arguments making a plain old PHP object (POPO) just as practical for this simple example.
If you haven’t tried Spatie’s DTO package, I hope even this simple example illustrates how you can know more about the data you transfer between objects. Imagine the above as an array of data:
$post = [
'title' => 'Hello World',
'body' => 'This is a test post.',
'author_id' => 1,
];
$someObject->doStuff($post);
Let’s say that your doStuff implementation looks like the following to keep the example simple:
function doStuff(array $post)
{
$title = ucwords($post['title']);
$author = findAuthorById($post['author_id']);
echo $title, "\n";
echo htmlspecialchars($post['body']);
echo $author['name'], "\n";
}
As a consumer of doStuff(), you have no idea the shape of the required data without referencing the implementation of doStuff(). That means when you need to call doStuff(), you have to look at the function to know what array data to pass.
The maintainer of a naive doStuff() implementation assumes that the consumer is sending required data. Sending malformed or missing data results in undefined key errors that might not crop up until after you’ve shipped a feature. Or, if you’re paranoid, you might need to check everything before you use it:
function doStuff(array $post)
{
if (empty($post['title'])) {
throw new \Exception('Missing title');
}
if (empty($post['body'])) {
throw new \Exception('Missing body');
}
if (empty($post['author_id'])) {
throw new \Exception('Missing author_id key');
}
$title = ucwords($post['title']);
$author = findAuthorById($post['author_id']);
echo $title, "\n";
echo htmlspecialchars($post['body']);
echo $author['name'], "\n";
}
Instead, you could guarantee the shape of data with a POPO or DTO (back in V1). It’s just that in DTO V2 and V3, some things are now handled natively through PHP 8’s language features instead of runtime checks:
function doStuff(PostData $post)
{
$author = findAuthorById($post->author_id);
echo $post->title, "\n";
echo htmlspecialchars($post->body);
echo $author->name, "\n";
}
IDEs understand PostData, making it easy to both use and construct new instances. In this naive example, we know what data to expect, and the DTO package ensures this data is structured as expected when the object gets constructed.
While structured, typed data might seem like a trivial boilerplate to the veteran Java developer, PHP developers are more prone to seeing associative array data passed back and forth in an application. PHP 8 and this DTO package go a long way in providing more assurances of the data passed around in your PHP applications, which I believe makes you more productive and your code more confident.
You can learn more about this package, get full installation instructions, and view the source code on GitHub. Freek Van der Herten and Brent Roose also wrote details of the Data Transfer Object v3 features if you’re looking for a more in-depth explanation and examples of the DTO package.
Laravel News
https://cdn.athlonoutdoors.com/wp-content/uploads/sites/8/2021/02/SIG-Sauer-NGSW.jpg
Few things in life dominate their purpose of existence quite like the A-10 Warthog and its GAU-8 Avenger 30mm Cannon. The two remain forever, intrinsically linked in military lore. From tanks to terrorist convoys, the 30mm round simply decimates everything in its path. In a word, it is glorious. So BRRRRRRRT! Let’s watch how this marvel of military might works in action.

RELATED STORY
SIG Sauer NGSW: US Army Receives Final Delivery of Complete System
YouTuber 3D Mil-Tech posted an awesome animation recently of the GUA-8 Avenger. And the stellar video makes it at once clear, this isn’t a gun, it’s a machine. The behemoth aircraft cannon weighs in at 619.5 pounds, measuring nearly 20 feet down the belly of the beast that is the Warthog. The 90.5-inch barrel weighs a massive 71.2 pounds.
It spits out massive 30mm rounds at a whopping 4,200 rpm. The tank buster sends rounds downrange at 3,500 fps. And the maximum effective range extends to 3,660 meters.
Certainly, the U.S. military inventory commands more impressive firepower. But when combined with the unique flying ability of the A-10, the GAU-8 Avenger excels. The combination famously busted more than 900 Iraqi tanks in Desert Storm. Timeless footage abounds of the Warthog slowly crawling across the sky, reigning fire down on enemy material and emplacements.
The Avenger employs Armor Piercing Incendiary (API) rounds. Loaded with depleted uranium, these bad boys hit like the proverbial hammer of Thor. Ultimately, few enemy tanks or positions can withstand the punch of the A-10 Warthog and the GAU-8 Avenger.
The original contract specifications called for the cannon to be capable of destroying a wide variety of targets expected during a close air support mission. It must destroy light, medium and heavy tanks, armored personnel carriers and fixed or mobile artillery. It would also need to take down hardened targets, including bunkers.
At various times, the military expressed interest in moving on from the Warthog. But then we get into a fight, the combination proves its mettle all over again. Long live the GAU-8 Avenger!
The post WATCH: How an A-10 Warthog GAU-8 Avenger 30mm Cannon Works appeared first on Tactical Life Gun Magazine: Gun News and Gun Reviews.
Tactical Life Gun Magazine: Gun News and Gun Reviews
https://www.pewpewtactical.com/wp-content/uploads/2021/04/AGAG-New-Shooter-Survey-2020.png
If you’ve wandered into the gun store recently, you might have noticed it looks a little different.
Among the rows of black handguns and FDE colored rifles, pinks, purples, and teals peer out from the gun case. Bedazzled ear pro, lacey holsters, and other feminine accessories line the shelves.
While the gun industry often looks to capitalize on new shooters, one demographic in particular is getting a lot of attention — women.
But what shaped this dramatic increase in female gun owners?
According to a Pew Research Center survey, in 2005, women accounted for only 13% of American gun owners.
By 2020, that number almost doubled, with women representing nearly 25% of gun owners in the United States.
Female gun owners are considered the fastest-growing demographic in the gun world.
But female gun ownership looks different than that of men.
On average, women opt into guns later in life. Women, on average, buy their first gun around the age of 27. In contrast, the average age for a man’s first gun is 19.
Self-defense is the most cited reason for gun ownership for both sexes. However, men typically list recreation, competition, or hunting alongside defense as reasons for purchasing firearms.
On the other hand, self-defense can often be the only reason for gun ownership among women. 27% of female gun owners say they have no further interest in firearms outside of personal protection.
In the U.S., 19.3% of women experience rape while 43.9% face sexual violence other than rape. With more than half of adult women living alone in the U.S., it’s no surprise women stock up on safety tools.
And firearms offer a solution.
“It’s a very helpless feeling knowing you can’t protect yourself or your family,” Terry Marsh told News & Observer after an intruder almost entered her home at 1 a.m. “If I had a gun or a way to protect myself, it would have given me a little bit of power, and I’d have felt secure.”
Marsh later went out and purchased her first handgun.
She’s not alone.
Women’s centric shooting organizations like The Well Armed Woman and A Girl & A Gun aim to encourage new shooters. They offer an alternative to all-male ranges and classes. Ultimately, these organizations emphasize safety thorugh training and education.
A Girl & A Gun boasts over 6,000 members with chapters in almost every state. The group noted a significant increase in interest and participation…especially in 2020.
2020, a year renowned for COVID-19 and heightened social tensions introduced more Americans to guns, gear, and ammo.
The FBI recorded over 39 million background checks for firearms in 2020. Just months into 2021, that number already sits at 12 million.
But in a time where gun sales remained at an all-time high, not all gun purchases were made by men.
In fact, women accounted for 40% of gun purchases in 2020.
Even gun organizations experienced this influx, with A Girl & A Gun’s membership spiking over 150% just by July 2020.
An examination of its new members showed that while most grew up in a home without guns, the fear of civil unrest pushed them to reconsider a gun-free home.
Kathryn, a woman from Texas, was one such gun owner. A trauma surgeon and admittedly anti-gun, she said the pandemic and unrest was a contributing factor in her decision to purchase a firearm for the first time.
“I’m a trauma surgeon and have treated a fair share of gunshot victims in Chicago and Houston. I have been pretty ‘anti-gun’ as a result up until COVID,” she told surveyors with A Girl & A Gun. “At that point, I figured I might as well get comfortable with at least handling firearms in case I had to use one.”
Instructors and educators also faced an influx of new shooters signing up for classes, including the female demographic.
“We are seeing single moms, the elderly, and most surprising is middle age couples that have never seen the need to be armed,” said GW Ayers III, chief operating officer at Rainier Arms Firearms Academy, the training unit of Wichita, Kansas-based Rainier Arms Group.
In 2020, Rainier says enrollment for its CCW courses jumped 50%.
Cherie Hicks, a 58-year-old mother and yoga instructor from California told Pew Pew Tactical that though she is an experienced shooter, she plans on “amping up” her training.
“After the rioting and the looting started, that was it,’’ Hicks explained.
Though COVID-19 vaccinations are rolling out and riots have calmed, gun sales haven’t slowed down — nor does it look like they will.
The National Shooting Sports Foundation’s Mark Oliva said with enhanced gun laws potentially on the horizon, Americans continue to stock up — women included.
“It is clear that firearm sales in March were driven by gun control calls from politicians to ban entire classes of firearms and enact onerous gun laws,” Oliva told CNN Business.
With estimates in the millions, more and more American women are entering the gun community. While some bemoan the use of pinks and purples in gun stores, experts say it’s imperative the industry encourages ladies.
“Women are making a difference in the world of firearms,” Carrie Lightfoot, founder of The Well Armed Woman, said. “I believe there is no denying that women are here to stay and, therefore, need the industry to continue to understand who they are and what they want.”
And the industry seems to be trying. Every day more accessories aimed at women sprout up in online stores. Even more encouraging, women-owned brands continue to enter the firearms landscape. These niche businesses specialize in firearm-themed gear apparel and accessories for women.
This approach is smart, according to Lightfoot’s data. Her small sampling of 5,000 women revealed ladies poured over $3.5 million into guns in 2019.
“The female market offers enormous potential and dollars to the firearms industry,” Lightfoot said.
The earning potential for gear, guns, and accessories marketed towards women is endless, so long as the industry is willing to provide intelligent, safety-conscious designs.
Armed with cash and willing to invest in their safety, female gun owners represent a fast growing subset of the gun community.
As long as the industry continues to support women through education, training, and gear, there are no indications lady shooters will slow down any time soon.
What are your thoughts on female gun ownership? Share your comments below. And make sure to check PPT every Wednesday for a new women-friendly article. In the meantime, check out our guide on the Best EDC Items for Women or read up on why gun publications should be including women.
The post Female Firearms Ownership: Why Women Buy Guns appeared first on Pew Pew Tactical.
Pew Pew Tactical
https://www.buckeyefirearms.org/sites/buckeyefirearms.org/files/styles/slideshow/public/field/image/project-appleseed.jpg?itok=e3-2hg3Q

As spring approaches, the Appleseed trail will soon start back up and we will begin building another group of Riflemen here in Ohio.
For those who don’t know about the Appleseed Project, we are a national 501(c)(3) non-profit organization that teaches the fundamentals of rifle marksmanship and combines this with a series of presentations on our shared heritage as Riflemen and Riflewomen.
Appleseed started thirteen years ago with the goal to reawaken America to the fading art of rifle marksmanship. We do that by teaching the fundamentals of field marksmanship and by sharing with our attendees the story of April 19, 1775.
Paul Revere’s ride, the events on Lexington Green, the engagement at the North Bridge, all have profound lessons for all of us on our shared marksmanship heritage and the price of liberty. Attending an Appleseed event will reacquaint you with our shared heritage and provide you with the rifle skills necessary to pass this heritage on to the next generation.
Our two-day events are staffed by skilled instructors who will share with you the skills needed to consistently hit targets out to 500 yards. Bring what you want to shoot. Open sights, scopes, centerfire or rim fire, we work with what our students bring.
Most of our work is done at 25 meters. Saturday at an Appleseed is heavy on instructions and drills. All this leads up to the Appleseed Qualification Test, the infamous AQT.
Our AQTs are a four-stage test to challenge your skills. We put you under some time pressure and ask you to execute 40 shots on targets that simulate ranges from 100-400 yards. It takes 210 points out of a possible 250 for you achieve your Rifleman’s patch and to leave with the pride of knowing that you are carrying on the great American Rifleman tradition.
Our events are open to all regardless of your skill levels. Youth are welcome as long as they can be safe on our line. We have worked with attendees from 8 to 80. Whether you are new to rifle marksmanship or are looking for a tune-up on your skills, we encourage you to join us for a weekend.
I can guarantee you will leave with a new appreciation for your skills, your country and the value of liberty.
Our 2020 schedule is available at appleseedinfo.org and we encourage you to come check us out. If you have any questions, feel free to contact me at ohio@appleseedinfo.org.
All of us at Appleseed would like to thank the Buckeye Firearms Association for supporting our program.
Buckeye Firearms Association
https://www.ammoland.com/wp-content/uploads/2018/10/Concealed-Carry-500×282.jpg

U.S.A.– -(AmmoLand.com)- Doctor John Lott is the president and one of the principal researchers at the Crime Prevention Research Center. Dr. Lott recently reminded us that guns save lives and stop mass murder. I’d forgotten about a few of these incidents, though I’m sure I read a little about them at the time. In contrast, the news media covers mass murderers for days on end. To help offset that media bias, let’s look back only 10 months to see what we did.
The list of armed defense incidents is much longer, but those are the ones that happened in the last 10 months. I suspect you are like me and forgot how often guns save lives. You forget the virtue of an armed society.
About Rob Morse
The original article is posted here. Rob Morse writes about gun rights at Ammoland, at Clash Daily, and on his SlowFacts blog. He hosts the Self Defense Gun Stories Podcast and co-hosts the Polite Society Podcast. Rob was an NRA pistol instructor and combat handgun competitor.
The post Carry a Concealed Firearm Because You Can Stop Mass Murder and Save Lives appeared first on AmmoLand.com.
AmmoLand.com
https://www.percona.com/blog/wp-content/uploads/2021/04/MySQL-101-Server-Triage.png
So your MySQL server has crashed. What do you do now? When a server is down, in my opinion, there are two steps that are essential and both are extremely important and neither should be neglected:
Too many people rush to Step #2 and lose pertinent diagnostics from Step #1. Likewise, too many people will spend too much time on Step #1 and delay getting to Step #2 and restoring service. The goal is to collect diagnostics as quickly as possible for later review while getting service restored as fast as possible.
As a Technical Account Manager (TAM) and assisting on server restoration calls, I have seen both issues at play. Technical resources have a tendency to get so bogged down in trying to understand the cause of the server outage that they forget that the downtime is costing the business money. The desire to crawl through server logs, review metrics, pour-over system metrics, and so on, can be too tempting for some who are concerned that important diagnostic data will be lost when service is restored. This is a valid concern, but there must be a middle ground.
Conversely, many, especially those in management, will demand service is restored immediately to continue business functions. Of course, after the service is back up, the demand for an RCA will come. Sadly, many metrics, and some logs, are lost when a server is bounced. Below are basic guidelines on what metrics to collect for MySQL. The steps are in no particular order.
sudo cp /path/to/datadir/*.log /some/where/safe
sudo cp /path/to/my.cnf /some/where/safe
sudo cp /var/log/syslog /some/where/safe/syslog sudo cp /var/log/messages /some/where/safe/messages sudo journalctl -e > /some/where/safe/journalctl.txt
sudo mysqladmin -i10 -c10 proc > /some/where/safe/mysql_procs.txt mysql> SHOW GLOBAL VARIABLES; sudo mysqladmin -i10 -c10 ext > /some/where/safe/mysql_ext.txt mysql> SHOW ENGINE INNODB STATUS\G
sudo ./pt-stalk --no-stalk --iterations=2 --sleep=30 --dest=/some/where/safe -- --user=root --password=<mysql-root-pass>;
sudo cp -R /path/to/datadir /some/where/safe/datadir
sudo cp /path/to/data/dir/GRA* /some/where/safe/datadir/
sudo mpstat -a 1 60 > /some/where/safe/mpstat.txt sudo vmstat 1 60 > /some/where/safe/vmstat.txt sudo iostat -dmx 1 60 > /some/where/safe/iostat.txt
sudo cat /proc/cpuinfo > /some/where/safe/cpuinfo.txt
sudo pt-summary > /some/where/safe/pt-summary.txt sudo pt-mysql-summary > /some/where/safe/pt-mysql-summary.txt
# disk info sudo df -k > /some/where/safe/df_k.txt sudo lsblk -o KNAME,SCHED,SIZE,TYPE,ROTA > /some/where/safe/lsblk.txt sudo lsblk --all > $PTDEST/lsblk-all; # lv/pv/vg only for systems with LVM sudo lvdisplay --all --maps > /some/where/safe/lvdisplau-all-maps.txt sudo pvdisplay --maps > /some/where/safe/pvdisplay-maps.txt sudo pvs -v > /some/where/safe/pvs_v.txt sudo vgdisplay > /some/where/safe/vgdisplay.txt # nfsstat for systems with NFS mounts sudo nfsstat -m > /some/where/safe/nfsstat_m.txt sudo nfsiostat 1 120 > /some/where/safe/nfsiostat.txt # Collect hardware information sudo dmesg > /some/where/safe/dmesg.txt sudo dmesg -T free -m > /some/where/safe/dmesg_free.txt sudo dmesg -T > /some/where/safe/dmesg_t.txt sudo ulimit -a > /some/where/safe/ulimit_a.txt sudo cat /proc/sys/vm/swappiness > /some/where/safe/swappiness sudo numactl --hardware > /some/where/safe/numactl-hardware.txt
It goes without saying, it would be best to script the above into a useful bash script you can run when there is an issue. Just be sure to test the script in advance of an issue.
Again, the goal is to preserve useful diagnostic data that could be useful for determining the root cause of the issue at a later time after the service is restored. Just don’t get caught up in looking through the above diagnostics! Certainly, more data is better but the above is a great starting point. As time goes on, you may realize you wish you had other metrics and can add them to your script or Standard Operating Procedure (SOP).
Naturally, adding monitoring like Percona Monitoring and Management (PMM) would be a great option that can save you a lot of time and collect even more trends over time which can be extremely helpful.
With the above diagnostics, you would have a ton of information in the event of an issue to find the root cause. Now, you can sort through the diagnostics. Of course, if you need help with that, Percona can help you here as well.
Planet MySQL
http://img.youtube.com/vi/A3-p3psej_w/0.jpgHow to create Complex headers in DatatableLaravel News Links
In ALTER TABLE for UUID we discuss currently proper way to store and handle UUID in MySQL. Currently it works, even in a performant way, but it still hurts. It should not.
The RFC 4122 defines various types of UUID, and how they are being formatted for presentation and as a bit field on the wire. As this document was written bei Leach and Salz, among others, RFC 4122 UUIDs are also called “Leach-Salz UUIDs” (for example in the Java Documentation).
There are other UUID variants, used in other systems (NCS, and Microsoft “backwards compatibility”).
A RFC 4122 UUID is a special 128 bit long value (“16 octets”). It is supposed to be laid out like this:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| time_low |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| time_mid | time_hi_and_version |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|clk_seq_hi_res | clk_seq_low | node (0-1) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| node (2-5) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The high bits in clk_seq_hi_res define the variant, and anything starting with the bit sequence 10 is a RFC 4122 compliant UUID.
The high nibble in time_hi_and_version defines the RFC 4122 Type (or version), the algorithm used. RFC 4122 itself defines versions 1 to 5 (version 0 is unused).
There is an expired draft that defines a version 6, which is specifically designed to use a primary key for databases. It uses the same timestamp value as Type 1, but stores the bytes so that ordering by creation time is preserved. It also relaxes the requirements on the node field, officially allowing different sources for bits than the MAC address. Sample implementations are available in various languages.
UUIDs are all over the place in Windows and also in Java. Databases have to handle them as “application generated primary keys”. That’s why they are important and should be treated with some attention.
MySQL provides functions to generate UUIDs, to check if a thing is a validly formatted string that looks like a UUID, and to convert UUIDs to 128 bit bitstrings and back.
The latter two functions have a special flag to improve performance with InnoDB. This flag is by default off. No attempt is made to automatically do the right thing dependent on the UUID type.
The MySQL function UUID() returns a RFC 4122 Type 1 UUID.
mysql> select uuid_to_bin(uuid()) as uuid;
+------------------------------------+
| uuid |
+------------------------------------+
| 0x80462D3C96AB11EB94BBBA2278F258E1 |
+------------------------------------+
1 row in set (0.00 sec)
Formatted like in the RFC, we get the following values:
80462D3C
96AB 1 1EB
9 4 BB B A22
78F258E1
Specifically, the clk_seq_hi_res contains the variant value, 9, and the time_hi_and_version contains the version, 1.
According to the RFC, the variant 9 = 1001 = 10x (a RFC 4122 compliant UUID).
Of the Versions defined in RFC 4122, it is Version 1 or Type 1, “The time-based version in this document”. The generation algorithm is defined in section 4.2 of that RFC.
So a MySQL generated UUID is always a RFC 4122 Type 1 (time based) UUID.
Compare with the Java UUID Class:
We have randomUUID(), returning a Type 4 UUID and nameUUIDFromBytes() for Type 3 and a generic Constructor that takes any 128 bit value. So what we get from Java is likely name based or random UUIDs generated by the application.
Name based UUIDs are fixed for a fixed name, so they pose no problem when used with MySQL as a primary key.
Random UUIDs are completely random. There is nothing to optimize for MySQL here.
Neither is a good choice to use as a kind of application controlled distribiuted primary key.
Based on the reasoning in ALTER TABLE for UUID, Java developers that are using UUID for this purpose would be well advised to implement and use a Type 1 UUID. It seems that such an implementation is not available by default as part of java.lang.util, but other implementations exist.
The IS_UUID() predicate returns 1 for all strings that can be parsed as a UUID.
That is, it checks for one of three ways to write the UUID, and that it contains only valid hex digits in the places that actually contain data. No attempt is made to validate any of the bits. Code is here, and the actual parsing happens here.
MySQL allows three ways to write UUIDs, as a 128 bit hex string (6ccd780cbaba102695645b8c656024db), as a 128 bit hex string with dashes in the right places (6CCD780C-BABA-1026-9564-5B8C656024DB) and as a 128 bit hex string with dashes in the right places and enclosed in curly braces ({6CCD780C-BABA-1026-9564-5B8C656024DB}).
This is not a particular dense packing of data for storage. The UUID_TO_BIN() function takes any of these strings and returns a VARBINARY(16) for storage.
The function has an optional second parameter, the swap_flag. When applied to a Type 1 UUID, the time bytes are being swapped around so that chronological ascending UUIDs from the same node are also having numerically ascending values. This optimizes storage with InnoDB.
VARBINARY(16) and use theUUID_TO_BIN(uuid_string, 1) function to store data.UUID_TO_BIN(uuid_string, 0) to store Type 6 UUIDs, because Type 6 has been specifically created to avoid the swapping of time bytes around.UUID_TO_BIN(uuid_string, 0).The inverse function to UUID_TO_BIN is BIN_TO_UUID(). It needs the same swap_flag value as has been used at write time in order to unpack the data correctly.
This all should hurt less.
UUID column type, which stores data internally in a VARBINARY(16) (or BINARY(16)).That is, I want to be able to
mysql> create table u ( u uuid not null primary key, dummy integer );
mysql> insert into u values (uuid(), 1);
mysql> select u from u\G
u: 6ccd780cbaba102695645b8c656024db
mysql> select format_uuid(u, 0) as u from u\G
u: 6CCD780C-BABA-1026-9564-5B8C656024DB
mysql> select format_uuid(u) as u from u\G
u: 6CCD780C-BABA-1026-9564-5B8C656024DB
mysql> select format_uuid(u, 1) as u from u\G
u: {6CCD780C-BABA-1026-9564-5B8C656024DB}
and internally, this is stored as 0x1026BABA6CCD780C95645B8C656024DB, because variant is RFC 4122 and Type is 1.
For any other Type of the RFC 4122 the internal swapping does not happen.
Trying to store anything that is not a RFC 4122 variant is an error. Trying to store anything that is a RFC 4122 variant but not a Type 1 to 6 is an error.
Planet MySQL









