For quite some time now I wanted to play around with the recently added JSON type in MySQL. Finally, I have a project where MySQL version is high enough to support it, and the requirements are such that this choice makes sense.
The first impression was great – JSON type is basically LONGTEXT type with a bunch of added functionality to manipulate JSON data. It took no time to setup tables and necessary queries to work with it.
The second iteration though raised a few questions. Large tables, with complex JSON structures were rather slow in some of the more complex queries. The first solution to look at was obviously indexes. Turns out, MySQL does not support indexing of the JSON fields. Bummer.
But there is a rather elegant work around. It involves another recently added feature, of which I haven’t heard about until today – GENERATED columns. Think of table views, but on the column level, not table level. And generated columns can be indexed.
In fact, there’s a whole lot that you can do with GENERATED columns in general, and JSON data in particular. This blog post – “MySQL for JSON: Generated Columns and Indexing” – provides a great starting point with examples and explanations, including a scenario with the primary key of the table being a generated column, with the data from the JSON-typed column.
Here’s one of the best YouTube videos I’ve seen in a very long time. In fact, I love is so much, I’ve decided to take in effort beyond just sharing it. Watch it first, and then I’ll share a list of reasons why I love it.
So, here we go with my own personal reasons of why I love it. In no particular order, as always.
It’s not about COVID-19/Coronavirus.
It’s positive, nice and kind.
It’s funny. Not like stupid funny, or stand-up funny. But it still is.
It has substance. It’s not a video for the sake of video. It’s a video about a rather long and complex project, which took a lot of effort.
It bridges the real world and technology, and shows how one helps the other.
It’s very personal, yet very global.
It demonstrates one of my strong believes, that even simply asking for something, even from total strangers, has merit. Not everyone will respond. Not everyone will respond in the way you want them to. But overall you’ll get more than you thought you would.
Cyprus made it high up the recognition list.
Political neutrality. A lot of the countries mentioned in this video, have a long, complex, and often violent relationship with each other. Yet, that doesn’t matter for this particular project.
Free stuff. Who doesn’t like free stuff.
Production of the video. It’s not over the top professional production, yet it’s not an amateur talking head, filmed on the mobile phone in the car.
Maps. I love maps, and especially checking them off on the global map. Bonus points for more than one color for checked out colors.
Flags. Even though I don’t collect or study flags, I love flags and their designs.
It’s work and family friendly. Easily shareable with everyone I know.
Bonus point: it just makes me feel good about the world.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.