SQL performance optimization-is the mysql subquery executed repeatedly?

Source: Internet
Author: User
Ask! When mysql returns a fixed result set, whether the result set is repeatedly executed, for example, 1: selectt. *, (selectcount (1) fromtable01) fromtable01t; for example, 2: selectt. *, (selectcount (1) fromtable01t2wheret2. keyt1.key) fromtable01t1; -- Nested subqueries like this will be executed repeatedly. Q: In the subquery traversal process in example 1 above, there are fixed result sets. Will the result be repeated for N times (N records )? How to check the performance of... mysqlsql in the execution plan

Ask! Whether the fixed result set returned by mysql is repeatedly executed
Example 1: select t. *, (select count (1) from table01) from table01 t;

For example, 2: select t. *, (select count (1) from table01 t2 where t2.key = t1.key) from table01 t1; -- Nested subqueries like this will be executed repeatedly.
Q: In the subquery traversal process in example 1 above, there are fixed result sets. Will the result be repeated for N times (N records )?
In the execution plan, how does one check whether the subquery has been executed repeatedly or analyze the execution efficiency of the subquery!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.