Question about using % (percentage) after like in mysql statements

Source: Internet
Author: User

Question about using % (percentage) after like in mysql statements

Question: Is the more mysql statements use the % (percent sign) after like, the slower the execution efficiency!

Total time: 0.0489 seconds 0.0691 0.0485 0.0467

SELECT 'goods _ name', 'goods _ img ', 'sku _ id ', 'import' FROM 'goods' WHERE 'goods _ name' LIKE '% iPhone % iPod %' AND 'stime' <1413877244 AND 'etime'> 1413877244 order by 'flag' DESC

Total time: 0.0460 seconds 0.0430 0.0493 0.0783

SELECT 'goods _ name', 'goods _ img ', 'sku _ id ', 'import' FROM 'goods 'where 'goods _ name' LIKE '% iPhone %' AND 'goods _ name' LIKE '% iPod %' AND 'stime' <1413877367 AND 'etime '> 1413877367 order by 'flag' DESC

Total duration: 0.0458 seconds 0.0441 seconds 0.0449 seconds

SELECT 'goods _ name', 'goods _ img ', 'sku _ id ', 'import' FROM 'goods' WHERE 'goods _ name' LIKE '% iPhone % iPod % 'AND 'stime' <1413877997 AND 'etime'> 1413877997 order' flag'desc

Practice has proved that the percent number does not affect the SQL Execution speed. The efficiency of these methods is almost the same.

The above is my test result. You can select a writing method based on your actual needs! We recommend that you select the second type!

Related Article

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.