SlideShare a Scribd company logo
1 of 23
Download to read offline
Slide 1/21
Slide 2/21
Slide 3/21
Introduction: Who are I and Ticketsolve
Lead of invisible things at Ticketsolve
Ticketsolve is a primary player in Ireland/UK in the events
ticketing market, and it has an internal open source program
Efficiency is one of our key values; this reflect in the presentation's
tooling and general approach
Slide 4/21
Introduction: Presentation and target audience
We've been using MySQL for 10+ years
We start each migration process around 6 months after GA
This presentation describes our experience in migrating to MySQL
8.0; it covers the most important concepts of what a sysadmin
needs to know and do, if "tomorrow they need to migrate
production to 8.0"
The most important subject is utf8mb4 (and its default collation)
There is no target level, although the audience is system/database
administrators
Slide 5/21
Preparing MySQL: setup and tooling
Use tarballs for convenience, and a fixed path with symlink
I'm using several scripts to speed up operations and access
frequently used terms
PS. I'm running fully on ZFS
Slide 6/21
Primary problems to tackle when migrating to MySQL 8.0:
Conversion to utf8mb4 with the correct collation (tables/triggers)
Trailing whitespace handled differently
GROUP BY not sorted anymore
information_schema not updated realtime anymore
Schema migration tools might not be compatible
The larger the scale, the more aspects will need to be considered, e.g.:
Dirty page cleaning parameters
Data dictionary contention
etc.
Slide 7/21
Migrating to utf8mb4: Summary
The new collation is the crucial aspect to consider
What `utf8mb4_0900_ai_ci` is and what it brings
Unfortunately, the documentation available in the web is outdated -
it uses the prerelease default collation (`utf8mb4_general_ci`)
Slide 8/21
How the charset parameters work
What happens when a client connects to the server?
Which are the database object charset-related defaults?
Slide 9/21
Strategy for a migration; collation coercion, and issues `general` <>
`0900_ai`
Change the connection settings, then migrate per-table.
I'll simulate all the cases of inter-charset comparisons.
Comparisons `utf8_general_ci` columns <> literals (see next)
Comparisons `utf8_general_ci` columns <> columns
Moving a schema from `utf8mb4_general_ci to`
`utf8mb4_0900_ai_ci` is not trivial!
Slide 10/21
Collation Coercibility in Expressions
0: An explicit COLLATE clause (not coercible at all)
1: The concatenation of two strings with different collations
2: The collation of a column or a stored routine parameter or local variable
3: A “system constant” (the string returned by functions such as USER() or VERSION())
4: The collation of a literal
5: The collation of a numeric or temporal value
6: NULL or an expression that is derived from NULL
(From https://dev.mysql.com/doc/refman/8.0/en/charset-collation-coercibility.html)
Slide 11/21
Issues with `0900_ai` collation padding
How are trailing whitespaces handled?
What defines such handling? (see next)
Slide 12/21
The following are the core string comparison rules from the SQL (2003) standard
(section 8.2):
3) The comparison of two character strings is determined as follows:
a) Let CS be the collation [...]
b) If the length in characters of X is not equal to the length in characters of Y, then
the shorter string is effectively replaced, for the purposes of comparison, with a
copy of itself that has been extended to the length of the longer string by
concatenation on the right of one or more pad characters, where the pad character
is chosen based on CS. If CS has the NO PAD characteristic, then the pad
character is an implementation-dependent character different from any character
in the character set of X and Y that collates less than any string under CS. Otherwise,
the pad character is a space.
Slide 13/21
Triggers
Triggers are fairly easy to handle (see next), as they can be
dropped/rebuilt - just make sure to consider comparisons in the
trigger body
Slide 14/21
Slide 15/21
Behavior with indexes
How does an `utf8mb4` index behave when comparing with an
`utf8` literal?
How does it behave on joins? What does one see in the standard
and extended `EXPLAIN`s?
Slide 16/21
Consequences of the increase in (potential) size of char columns
utf8mb4 characters will take 33% more, which must stay withing
the InnoDB index limit, which is however (as of 8.0 default), high
(3072 bytes).
Remember:
`[VAR]CHAR(n)` refers to the number of characters; therefore, the
maximum requirement is `4 * n` bytes
`TEXT` fields refer to the number of bytes
Slide 17/21
`information_schema_stats_expiry` introduction
When querying the `information_schema`, beware that stats are
updated only once a day!
If required, invoke `ANALYZE TABLE` (or reduce the setting
value)
Slide 18/21
GROUP BY is now unsorted (not implicitly sorted)
Developers will need to go through the codebase and check each
query with GROUP BY
It's impossible to use a one-size-fits-all approach
Very generic approaches:
grep -A
mini script checking every pair of lines
Slide 19/21
Schema migration tool issues
There's a known [breaking bug](github/gh-ost/issues/687) on the
latest Gh-ost release, which may prevent operations from
succeeding on MySQL 8
There's a test fix PR, it would be great if somebody with scale
could test it!
Use trigger-based tools, like `pt-online-schema-change` v3.1.1 or
v3.0.x (but v3.1.0 has a breaking bug) or Facebook's
OnlineSchemaChange
Slide 20/21
Conclusion
Over the next weeks, I will expand this subject into a series of
articles in my professional blog
This presentation is hosted (with git history preserved) at
https://github.com/saveriomiroddi/prefosdem-2020-presentation
Those who'd like to give ZFS a spin can check out my installer:
https://github.com/saveriomiroddi/zfs-installer
Slide 21/21
Extra: comparing the global system variables between major releases
Although we read the release notes for every release (including
patch versions), approaching major version changes is very
intimidating
Comparing system variables is a good starting point
Check out the bulky system variables, and filter them out
Extra 1/2
Extra: Mac Homebrew default collation is `utf8mb4_general_ci`!
When MySQL is installed via Homebrew, the default collation is
`utf8mb4_general_ci`.
My fix PR has been merged into master
Interim solution 1: edit the formula and rebuild mysql
Interim solution 2: disable the server handshake
Extra 2/2

More Related Content

Similar to Friends let real friends use MySQL 8.0

A sane approach to microservices
A sane approach to microservicesA sane approach to microservices
A sane approach to microservicesToby Matejovsky
 
Rac Optimisation For Siebel Crm, Doag 2008
Rac Optimisation For Siebel Crm, Doag 2008Rac Optimisation For Siebel Crm, Doag 2008
Rac Optimisation For Siebel Crm, Doag 2008Frank
 
Presen 179
Presen 179Presen 179
Presen 179s1140179
 
Presentation to dm as november 2007 with dynamic provisioning information
Presentation to dm as   november 2007 with dynamic provisioning informationPresentation to dm as   november 2007 with dynamic provisioning information
Presentation to dm as november 2007 with dynamic provisioning informationxKinAnx
 
186 devlin p-poster(2)
186 devlin p-poster(2)186 devlin p-poster(2)
186 devlin p-poster(2)vaidehi87
 
A SYSTEMC/SIMULINK CO-SIMULATION ENVIRONMENT OF THE JPEG ALGORITHM
A SYSTEMC/SIMULINK CO-SIMULATION ENVIRONMENT OF THE JPEG ALGORITHMA SYSTEMC/SIMULINK CO-SIMULATION ENVIRONMENT OF THE JPEG ALGORITHM
A SYSTEMC/SIMULINK CO-SIMULATION ENVIRONMENT OF THE JPEG ALGORITHMVLSICS Design
 
IRJET- A Review- FPGA based Architectures for Image Capturing Consequently Pr...
IRJET- A Review- FPGA based Architectures for Image Capturing Consequently Pr...IRJET- A Review- FPGA based Architectures for Image Capturing Consequently Pr...
IRJET- A Review- FPGA based Architectures for Image Capturing Consequently Pr...IRJET Journal
 
But is it Art(ificial Intelligence)?
But is it Art(ificial Intelligence)? But is it Art(ificial Intelligence)?
But is it Art(ificial Intelligence)? Alan Sardella
 
Angular js meetup
Angular js meetupAngular js meetup
Angular js meetupAnton Kropp
 
E catt tutorial
E catt tutorialE catt tutorial
E catt tutorialNaveen Raj
 
LAS16-TR03: Upstreaming 201
LAS16-TR03: Upstreaming 201LAS16-TR03: Upstreaming 201
LAS16-TR03: Upstreaming 201Linaro
 
Design the implementation of CDEx Robust DC Motor.
Design the implementation of CDEx Robust DC Motor.Design the implementation of CDEx Robust DC Motor.
Design the implementation of CDEx Robust DC Motor.Ankita Tiwari
 
From Prototyping to Deployment at Scale with R and sparklyr with Kevin Kuo
From Prototyping to Deployment at Scale with R and sparklyr with Kevin KuoFrom Prototyping to Deployment at Scale with R and sparklyr with Kevin Kuo
From Prototyping to Deployment at Scale with R and sparklyr with Kevin KuoDatabricks
 
Whitepaper nebucom intelligent application broking and provisioning in a hybr...
Whitepaper nebucom intelligent application broking and provisioning in a hybr...Whitepaper nebucom intelligent application broking and provisioning in a hybr...
Whitepaper nebucom intelligent application broking and provisioning in a hybr...Nebucom
 
Solving the weak spots of serverless with directed acyclic graph model
Solving the weak spots of serverless with directed acyclic graph modelSolving the weak spots of serverless with directed acyclic graph model
Solving the weak spots of serverless with directed acyclic graph modelVeselin Pizurica
 
Xml Validation Test Suite With Camv
Xml Validation Test Suite With CamvXml Validation Test Suite With Camv
Xml Validation Test Suite With CamvBizagi Inc
 
Limited Budget but Effective End to End MLOps Practices (Machine Learning Mod...
Limited Budget but Effective End to End MLOps Practices (Machine Learning Mod...Limited Budget but Effective End to End MLOps Practices (Machine Learning Mod...
Limited Budget but Effective End to End MLOps Practices (Machine Learning Mod...IRJET Journal
 

Similar to Friends let real friends use MySQL 8.0 (20)

A sane approach to microservices
A sane approach to microservicesA sane approach to microservices
A sane approach to microservices
 
Rac Optimisation For Siebel Crm, Doag 2008
Rac Optimisation For Siebel Crm, Doag 2008Rac Optimisation For Siebel Crm, Doag 2008
Rac Optimisation For Siebel Crm, Doag 2008
 
Matopt
MatoptMatopt
Matopt
 
Presen 179
Presen 179Presen 179
Presen 179
 
Presentation to dm as november 2007 with dynamic provisioning information
Presentation to dm as   november 2007 with dynamic provisioning informationPresentation to dm as   november 2007 with dynamic provisioning information
Presentation to dm as november 2007 with dynamic provisioning information
 
186 devlin p-poster(2)
186 devlin p-poster(2)186 devlin p-poster(2)
186 devlin p-poster(2)
 
spss Help
spss Helpspss Help
spss Help
 
A SYSTEMC/SIMULINK CO-SIMULATION ENVIRONMENT OF THE JPEG ALGORITHM
A SYSTEMC/SIMULINK CO-SIMULATION ENVIRONMENT OF THE JPEG ALGORITHMA SYSTEMC/SIMULINK CO-SIMULATION ENVIRONMENT OF THE JPEG ALGORITHM
A SYSTEMC/SIMULINK CO-SIMULATION ENVIRONMENT OF THE JPEG ALGORITHM
 
IRJET- A Review- FPGA based Architectures for Image Capturing Consequently Pr...
IRJET- A Review- FPGA based Architectures for Image Capturing Consequently Pr...IRJET- A Review- FPGA based Architectures for Image Capturing Consequently Pr...
IRJET- A Review- FPGA based Architectures for Image Capturing Consequently Pr...
 
But is it Art(ificial Intelligence)?
But is it Art(ificial Intelligence)? But is it Art(ificial Intelligence)?
But is it Art(ificial Intelligence)?
 
Angular js meetup
Angular js meetupAngular js meetup
Angular js meetup
 
E catt tutorial
E catt tutorialE catt tutorial
E catt tutorial
 
LAS16-TR03: Upstreaming 201
LAS16-TR03: Upstreaming 201LAS16-TR03: Upstreaming 201
LAS16-TR03: Upstreaming 201
 
Design the implementation of CDEx Robust DC Motor.
Design the implementation of CDEx Robust DC Motor.Design the implementation of CDEx Robust DC Motor.
Design the implementation of CDEx Robust DC Motor.
 
From Prototyping to Deployment at Scale with R and sparklyr with Kevin Kuo
From Prototyping to Deployment at Scale with R and sparklyr with Kevin KuoFrom Prototyping to Deployment at Scale with R and sparklyr with Kevin Kuo
From Prototyping to Deployment at Scale with R and sparklyr with Kevin Kuo
 
Whitepaper nebucom intelligent application broking and provisioning in a hybr...
Whitepaper nebucom intelligent application broking and provisioning in a hybr...Whitepaper nebucom intelligent application broking and provisioning in a hybr...
Whitepaper nebucom intelligent application broking and provisioning in a hybr...
 
Solving the weak spots of serverless with directed acyclic graph model
Solving the weak spots of serverless with directed acyclic graph modelSolving the weak spots of serverless with directed acyclic graph model
Solving the weak spots of serverless with directed acyclic graph model
 
Xml Validation Test Suite With Camv
Xml Validation Test Suite With CamvXml Validation Test Suite With Camv
Xml Validation Test Suite With Camv
 
First fare 2010 lab-view overview
First fare 2010 lab-view overviewFirst fare 2010 lab-view overview
First fare 2010 lab-view overview
 
Limited Budget but Effective End to End MLOps Practices (Machine Learning Mod...
Limited Budget but Effective End to End MLOps Practices (Machine Learning Mod...Limited Budget but Effective End to End MLOps Practices (Machine Learning Mod...
Limited Budget but Effective End to End MLOps Practices (Machine Learning Mod...
 

Recently uploaded

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 

Recently uploaded (20)

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 

Friends let real friends use MySQL 8.0

  • 4. Introduction: Who are I and Ticketsolve Lead of invisible things at Ticketsolve Ticketsolve is a primary player in Ireland/UK in the events ticketing market, and it has an internal open source program Efficiency is one of our key values; this reflect in the presentation's tooling and general approach Slide 4/21
  • 5. Introduction: Presentation and target audience We've been using MySQL for 10+ years We start each migration process around 6 months after GA This presentation describes our experience in migrating to MySQL 8.0; it covers the most important concepts of what a sysadmin needs to know and do, if "tomorrow they need to migrate production to 8.0" The most important subject is utf8mb4 (and its default collation) There is no target level, although the audience is system/database administrators Slide 5/21
  • 6. Preparing MySQL: setup and tooling Use tarballs for convenience, and a fixed path with symlink I'm using several scripts to speed up operations and access frequently used terms PS. I'm running fully on ZFS Slide 6/21
  • 7. Primary problems to tackle when migrating to MySQL 8.0: Conversion to utf8mb4 with the correct collation (tables/triggers) Trailing whitespace handled differently GROUP BY not sorted anymore information_schema not updated realtime anymore Schema migration tools might not be compatible The larger the scale, the more aspects will need to be considered, e.g.: Dirty page cleaning parameters Data dictionary contention etc. Slide 7/21
  • 8. Migrating to utf8mb4: Summary The new collation is the crucial aspect to consider What `utf8mb4_0900_ai_ci` is and what it brings Unfortunately, the documentation available in the web is outdated - it uses the prerelease default collation (`utf8mb4_general_ci`) Slide 8/21
  • 9. How the charset parameters work What happens when a client connects to the server? Which are the database object charset-related defaults? Slide 9/21
  • 10. Strategy for a migration; collation coercion, and issues `general` <> `0900_ai` Change the connection settings, then migrate per-table. I'll simulate all the cases of inter-charset comparisons. Comparisons `utf8_general_ci` columns <> literals (see next) Comparisons `utf8_general_ci` columns <> columns Moving a schema from `utf8mb4_general_ci to` `utf8mb4_0900_ai_ci` is not trivial! Slide 10/21
  • 11. Collation Coercibility in Expressions 0: An explicit COLLATE clause (not coercible at all) 1: The concatenation of two strings with different collations 2: The collation of a column or a stored routine parameter or local variable 3: A “system constant” (the string returned by functions such as USER() or VERSION()) 4: The collation of a literal 5: The collation of a numeric or temporal value 6: NULL or an expression that is derived from NULL (From https://dev.mysql.com/doc/refman/8.0/en/charset-collation-coercibility.html) Slide 11/21
  • 12. Issues with `0900_ai` collation padding How are trailing whitespaces handled? What defines such handling? (see next) Slide 12/21
  • 13. The following are the core string comparison rules from the SQL (2003) standard (section 8.2): 3) The comparison of two character strings is determined as follows: a) Let CS be the collation [...] b) If the length in characters of X is not equal to the length in characters of Y, then the shorter string is effectively replaced, for the purposes of comparison, with a copy of itself that has been extended to the length of the longer string by concatenation on the right of one or more pad characters, where the pad character is chosen based on CS. If CS has the NO PAD characteristic, then the pad character is an implementation-dependent character different from any character in the character set of X and Y that collates less than any string under CS. Otherwise, the pad character is a space. Slide 13/21
  • 14. Triggers Triggers are fairly easy to handle (see next), as they can be dropped/rebuilt - just make sure to consider comparisons in the trigger body Slide 14/21
  • 16. Behavior with indexes How does an `utf8mb4` index behave when comparing with an `utf8` literal? How does it behave on joins? What does one see in the standard and extended `EXPLAIN`s? Slide 16/21
  • 17. Consequences of the increase in (potential) size of char columns utf8mb4 characters will take 33% more, which must stay withing the InnoDB index limit, which is however (as of 8.0 default), high (3072 bytes). Remember: `[VAR]CHAR(n)` refers to the number of characters; therefore, the maximum requirement is `4 * n` bytes `TEXT` fields refer to the number of bytes Slide 17/21
  • 18. `information_schema_stats_expiry` introduction When querying the `information_schema`, beware that stats are updated only once a day! If required, invoke `ANALYZE TABLE` (or reduce the setting value) Slide 18/21
  • 19. GROUP BY is now unsorted (not implicitly sorted) Developers will need to go through the codebase and check each query with GROUP BY It's impossible to use a one-size-fits-all approach Very generic approaches: grep -A mini script checking every pair of lines Slide 19/21
  • 20. Schema migration tool issues There's a known [breaking bug](github/gh-ost/issues/687) on the latest Gh-ost release, which may prevent operations from succeeding on MySQL 8 There's a test fix PR, it would be great if somebody with scale could test it! Use trigger-based tools, like `pt-online-schema-change` v3.1.1 or v3.0.x (but v3.1.0 has a breaking bug) or Facebook's OnlineSchemaChange Slide 20/21
  • 21. Conclusion Over the next weeks, I will expand this subject into a series of articles in my professional blog This presentation is hosted (with git history preserved) at https://github.com/saveriomiroddi/prefosdem-2020-presentation Those who'd like to give ZFS a spin can check out my installer: https://github.com/saveriomiroddi/zfs-installer Slide 21/21
  • 22. Extra: comparing the global system variables between major releases Although we read the release notes for every release (including patch versions), approaching major version changes is very intimidating Comparing system variables is a good starting point Check out the bulky system variables, and filter them out Extra 1/2
  • 23. Extra: Mac Homebrew default collation is `utf8mb4_general_ci`! When MySQL is installed via Homebrew, the default collation is `utf8mb4_general_ci`. My fix PR has been merged into master Interim solution 1: edit the formula and rebuild mysql Interim solution 2: disable the server handshake Extra 2/2