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]Join Percona’s Senior Architect, Matthew Boehm, as he presents What You Need to Get the Most Out of Indexes – Part 2 webinar on Thursday, October 19, 2017, at 11:00 am PDT / 2:00 pm EDT (UTC-7).
Proper indexing is key to database performance. Finely tune your query writing and database performance with tips from the experts. MySQL offers a few different types of indexes and uses them in a variety of ways.
In this session you’ll learn:
- How to use composite indexes
- Other index usages besides lookup
- How to find …
In this blog, I will provide answers to the Q & A for the Troubleshooting Slow Queries webinar.
First, I want to thank you for attending the April 28 webinar. The recording and slides for the webinar are available here. Below is the list of your questions that I wasn’t able to answer during the webinar, with responses:
Q: I’ve heard that is a bad idea to use
select *
; what do you recommend?
A: When I used
SELECT *
in my slides, I wanted to underline the idea that sometimes you need to select all columns from …
[Read more]