MariaDb SQL query Performance considerations

Source: Internet
Author: User

Where,on and order by specify fields to be indexed

The result of a complex calculation should be written after the build rather than every read, unless the cost of writing is greater than the read

In addition to avoiding the occurrence of count (*) outside of paging, count data is added with a count field when writing to determine if there is a exists () function with a short-circuit mechanism

Avoid cases where sum () is used, and the corresponding results should be accumulated when a separate table is written

In any case, do not use not in (), use in (), exists (), not exists (), and union queries instead

In () can not contain SQL query, if need to include query, use exists () function and equivalent condition instead

In any case, you should avoid using an outer-connected query, instead of using an inline query + multiple SQL queries.

MariaDb SQL query Performance considerations

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.