Presenting the newly released MySQL Cookbook 4th edition to help developers and administrators to understand simple to complex recipes.
MySQL Cookbook 4th edition was released this summer. We are the book's authors and will show you how to "cook" MySQL. We will show you a few tasks with different priorities, such as JSON in MySQL for those who need flexibility, modern SQL for analytics, and Group Replication for high availability. We will also show how to write programs using JavaScript and Python languages, X DevAPI, and MySQL Shell. We will touch on some of the exciting features of MySQL Spatial Indexes and Geographical Data, Using a Full-Text Search, and more. We're hoping this talk will interest developers and administrators of MySQL.
I'd like to share my authoring experience e and knowledge about an open-source database product MySQL. I also want to touch on this journey's technical and non-technical aspects giving vision and inspiration to future authors. At the end of the talk, I will give away one printed copy of the MySQL Cookbook 4e to an audience after a trivia question.
4. About ChistaDATA Inc.
● Founded in 2021 by Shiv Iyer - CEO and Principal
● Has received 3M USD seed investment
● Focusing on ClickHouse infrastructure operations
○ What’s ClickHouse anyway?
● Services around dedicated DBaaS, Managed Services,
Support and Consulting
● We’re hiring globally DBAs, SREs and DevOps Engineers
@ChistaDATA Inc. 2022
@ask_dba
5. About ClickHouse
● Columnar Storage
● SQL Compatible
● Open Source (Apache 2.0)
● Shared Nothing Architecture
● Parallel Execution
● Rich in Aggregate Functions
● Super fast for Analytics workload
@ChistaDATA Inc. 2022
@ask_dba
6. About MySQL Cookbook 4th Edition
● O’reilly Book previously authored by Paul Dubois 3 editions
● Solutions for Database Developers and Administrators
● More than 950 pages of recipes for specific database challenges
● It took two years of authoring, rewriting, reviewing, editing and
learning.
● Co-authored with Sveta Smirnova - MySQL Expert / Author , Percona
@ChistaDATA Inc. 2022
@ask_dba
7. How did I end up there?
10,000 hours?
@ChistaDATA Inc. 2022
@ask_dba
8. How did I end up there?
● It wasn’t by luck maybe co-incidental
● Wanted to author one before
● Failed attempts
● Recognition
● Pandemic
@ChistaDATA Inc. 2022
@ask_dba
9. Stages ?
● Preparations
○ Agreement on the book (pages, percentile of content if new release)
○ Contracts signed
○ Authoring platform discussions
■ Docbook over XML / Asciidoc
■ This is important piece of decision
○ Editor(s) assigned by O’reilly
○ Supervisor assigned by O’reilly
@ChistaDATA Inc. 2022
@ask_dba
10. Stages ?
● Authoring
○ Start with difficult chapters
○ Allow research time
○ Use of editor (Grammarly) and available resources
○ Getting inside (co-author) and outside help
○ Review process
○ Final edits before many final reviews and approvals
@ChistaDATA Inc. 2022
@ask_dba
11. Stages ?
● Putting all together
1. Authoring is confirmed by the author (if co-authoring) if not this will be done by
technical reviewers
2. Reviewed by immediate editor
3. Chapters passes quality assurance by marking them complete and ready for pre-release.
4. While pre-releases published by chapters other chapters ongoing and technical reviews
starts.
5. They all randomly come back with feedback
@ChistaDATA Inc. 2022
@ask_dba
12. Builds ?
● Every version is a complete book repo in GitLab.
1. Use gitlab to pull changes. If two authors working together make sure to be up
to date.
2. Edit changes in a chapter
3. Push changes to repo
4. Push all updates, instructions to code repo (GitHub)
5. Make a compile request as pdf
6. Review (again)
@ChistaDATA Inc. 2022
@ask_dba
13. Production Schedule ?
1. Cover of the book (illustrations)
2. Pre-copyedit cleanup (Code blocks, Wording, Grammar and Spelling)
3. Copyedit review
4. Quality Control #1
5. Praise quotes for back cover
6. Index review
7. Quality Control #2
@ChistaDATA Inc. 2022
@ask_dba
14. Became an O'reilly Author
● Authored blogs
● Attempted to author booklet
○ Invited many co-authors
○ Talked to other editors
● Given talks online and offline
○ Mentored others to give talks
● On the field and always focused on same subject (Open Source, MySQL, Databases)
● Got an invitation by long time friend and colleague Sveta Smirnova
@ChistaDATA Inc. 2022
@ask_dba
15. Key Takeaways
● Talk to other authors
● Platform research
● Keep close track of agreements and details
● Organize your time in advance (allow extra time)
● Do not overcommit (work / life / book) balance
● More on this in another blog - MySQL Cookbook 4th Edition
● Details about the book in Percona University Nov 5 10:00 - 18:00
@ChistaDATA Inc. 2022
@ask_dba
16. A new book? Maybe
● I’m going to be co-authoring :
○ Database Design and Modeling for MySQL and PostgreSQL
Details coming soon…
@ChistaDATA Inc. 2022
@ask_dba
17. What’s in it?
Problem & Solution Recipes
Problem
You want to store and query geographic coordinates effectively.
Solution
Use MySQL’s improved Spatial Reference System.
18. MySQL’s improved Spatial Reference System
Creating geometries in various formats
Converting geometries between formats
Accessing qualitative and quantitative properties of geometry
Describing relations between two geometries
Creating new geometries from existing ones
19. Different variations of geographic data references
mysql> SELECT * FROM INFORMATION_SCHEMA.ST_SPATIAL_REFERENCE_SYSTEMS
-> WHERE SRS_ID=4326 OR SRS_ID=3857 ORDER BY SRS_ID DESC G
*************************** 1. row ***************************
SRS_NAME: WGS 84
SRS_ID: 4326
ORGANIZATION: EPSG
ORGANIZATION_COORDSYS_ID: 4326
DEFINITION: GEOGCS["WGS 84",DATUM["World Geodetic System 1984",
SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],
AXIS["Lat",NORTH],AXIS["Lon",EAST],AUTHORITY["EPSG","4326"]]
DESCRIPTION: NULL
…
20. SRS_ID 4326 represents map projections used in Google
Maps
mysql> CREATE TABLE poi
-> ( poi_id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-> position POINT NOT NULL SRID 4326, name VARCHAR(200));
Query OK, 0 rows affected (0.02 sec)
21. Insert GeoSpatial data with ST_GeomFromText()
mysql> INSERT INTO poi VALUES (1, ST_GeomFromText('POINT(41.0211 29.0041)', 4326),
-> 'Maiden's Tower');
Query OK, 1 row affected (0.00 sec)
msyql> INSERT INTO poi VALUES (2, ST_GeomFromText('POINT(41.0256 28.9742)', 4326),
-> 'Galata Tower');
Query OK, 1 row affected (0.00 sec)
22. Create SPATIAL index
mysql> CREATE SPATIAL INDEX position ON poi (position);
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
23. Measure the distance between coordinates ST_Distance()
mysql> SELECT ST_AsText(position) FROM poi WHERE poi_id = 1 INTO @tower1;
Query OK, 1 row affected (0.00 sec)
mysql> SELECT ST_AsText(position) FROM poi WHERE poi_id = 2 INTO @tower2;
Query OK, 1 row affected (0.00 sec)
mysql> SELECT ST_Distance(ST_GeomFromText(@tower1, 4326),
-> ST_GeomFromText(@tower2, 4326)) AS distance;
+--------------------+
| distance |
+--------------------+
| 2563.9276036976544 |
+--------------------+
1 row in set (0.00 sec)
24. Improved Earth’s spherical shape with
ST_Distance_Sphere ()
mysql> SELECT ST_Distance_Sphere(ST_GeomFromText(@tower1, 4326),
-> ST_GeomFromText(@tower2, 4326)) AS dist;
+--------------------+
| dist |
+--------------------+
| 2557.7412439442496 |
+--------------------+
1 row in set (0.00 sec)
25. Set a polygon with coordinates
mysql> SET @poly := ST_GeomFromText ( 'POLYGON(( 41.104897239651905 28.876082545638166,
-> 41.05727989444261 29.183699733138166,
-> 40.90384226781947 29.137007838606916,
-> 40.94119778455447 28.865096217513166,
-> 41.104897239651905 28.876082545638166))', 4326);
26. Find two towers from Istanbul using SPATIAL index
ST_Within()
mysql> SELECT poi_id, name, ST_AsText(`position`)
-> AS `towers` FROM poi WHERE ST_Within( `position`, @poly) ;
+--------+----------------+------------------------+
| poi_id | name | towers |
+--------+----------------+------------------------+
| 1 | Maiden's Tower | POINT(41.0211 29.0041) |
| 2 | Galata Tower | POINT(41.0256 28.9742) |
+--------+----------------+------------------------+
2 rows in set (0.00 sec)