I love my job. One of the best feelings is when I find an interesting paper and use it to solve a real problem. It feels like I found a cheat code. Instead of having to do a lot of hard thinking, I can just stand on the shoulders of really big people and take a shortcut. Here, I want to share a recent project that I could solve using a public paper.
Introduction # In this blog post, we will discuss an example of a change to the Vitess query planner and how it enhances the optimization process. The new model focuses on making every step in the optimization pipeline a runnable plan. This approach offers several benefits, including simpler understanding and reasoning, ease of testing, and the ability to use arbitrary expressions in ordering, grouping, and aggregations. Vitess distributed query planner # VTGate is the proxy component of Vitess.
Introduction # I recently encountered an intriguing bug. A user reported that their query was causing vtgate to fetch a large amount of data, sometimes resulting in an Out Of Memory (OOM) error. For a deeper understanding of grouping and aggregations on Vitess, I recommend reading this prior blog post. The Query # The problematic query was: selectsum(user.type)fromuserjoinuser_extraonuser.team_id=user_extra.idgroupbyuser_extra.idorderbyuser_extra.id;The planner was unable to delegate aggregation to MySQL, leading to the fetching of a significant amount of data for aggregation.
As of MySQL 8.0.18, EXPLAIN ANALYZE
is an
indispensable tool for understanding query execution because it
breaks down the query execution stage of response time by
measuring each step of the query execution plan. The information
is illuminating, but the output is not intuitive: it requires
practice and some understanding of how MySQL executes queries
beyond the table join order shown by traditional
EXPLAIN
output. This blog post closely examines
three different examples of EXPLAIN ANALYZE
output.
As of MySQL 8.0.18, EXPLAIN ANALYZE
is an
indispensable tool for understanding query execution because it
breaks down the query execution stage of response time by
measuring each step of the query execution plan. The information
is illuminating, but the output is not intuitive: it requires
practice and some understanding of how MySQL executes queries
beyond the table join order shown by traditional
EXPLAIN
output. This blog post closely examines
three different examples of EXPLAIN ANALYZE
output.
As of MySQL 8.0.18, EXPLAIN ANALYZE
is an
indispensable tool for understanding query execution because it
breaks down the query execution stage of response time by
measuring each step of the query execution plan. The information
is illuminating, but the output is not intuitive: it requires
practice and some understanding of how MySQL executes queries
beyond the table join order shown by traditional
EXPLAIN
output. This blog post closely examines
three different examples of EXPLAIN ANALYZE
output.
Query planning is hard # Have you ever wondered what goes on behind the scenes when you execute a SQL query? What steps are taken to access your data? In this article, I'll talk about the history of Vitess's V3 query planner, why we created a new query planner, and the development of the new Gen4 query planner. Vitess is a horizontally scalable database solution which means that a single table can be spread out across multiple database instances.
Originally posted at Andres's blog. Traditional query optimizing is mostly about two things: first, in which order and from where to access data, and then how to then combine it. You have probably seen the tree shapes execution plans that are produced from query planning. I’ll use an example from the MySQL docs, using FORMAT=TREE which was introduced in MySQL 8.0: mysql>EXPLAINFORMAT=TREE->SELECT*->FROMt1->JOINt2->ON(t1.c1=t2.c1ANDt1.c2<t2.c2)->JOINt3->ON(t2.c1=t3.c1)\G***************************1.row***************************EXPLAIN:->Innerhashjoin(t3.c1=t1.c1)(cost=1.05rows=1)->Tablescanont3(cost=0.35rows=1)->Hash->Filter:(t1.c2<t2.c2)(cost=0.70rows=1)->Innerhashjoin(t2.c1=t1.c1)(cost=0.70rows=1)->Tablescanont2(cost=0.35rows=1)->Hash->Tablescanont1(cost=0.35rows=1)Here we can see that the MySQL optimizer thinks the best plan is to start reading from t1 using a table scan.
Please join Percona’s MySQL Database Administrator, Brad Mickel as he presents How to Analyze and Tune MySQL Queries for Better Performance on Thursday, June 21st, 2018, at 10:00 AM PDT (UTC-7) / 1:00 PM EDT (UTC-4).
Query performance is essential in making any application successful. In order to finely tune your queries you first need to understand how MySQL executes them, and what tools are available to help identify problems.
In this session you will learn:
- The common tools for researching problem queries
- What an Index is, and why you should use one
- Index limitations
- When to rewrite the …
Join Percona Chief Evangelist Colin Charles as he covers happenings, gives pointers and provides musings on the open source database community.
I highly recommend submitting to the CFP for Percona Live Santa Clara 2018 even though it only closes December 22 2017. By the 3rd week of December, i.e. before the CfP closes, it is very likely that we will announce some of the schedule. So get in early! Keep in mind the broad topics, there are some ideas here.
Also: we are looking for sponsors for Percona Live – you can email me for more information.
Releases
[Read more]