Which MYSQL Query is faster? how can this problem be solved?

Source: Internet
Author: User
Which query is faster for MYSQL? First, Table 1: primary key is A (20-bit bigint type), and field B is A string (the auto-increment ID of table 2, multiple separate) Table 2: Record 2: record table, field A auto-incrementing, field B is (20-bit bigint type, repeatable, add index) assume that the data is large, to get a 20-bit bigin MYSQL, which query is faster?

First:
Table 1: primary key is A (20-bit bigint type), and field B is A string (the auto-increment ID of table 2, separated)
Table 2: Records

Second:
Record table, field A auto-increment, field B is (20-bit bigint type, repeatable, add index)


If the data is large, which design queries are fast in order to get a 20-bit bigint data list?
------ Solution --------------------
Reference:
Reference: 20-bit bigint. is it necessary to be so big? Be careful with 64bit Integer events.
What events? I have never heard of it. please explain it.
Converts a string to a BIGINT type.



$ Large_number = 922337203685477580800;
Echo $ large_number; // 9.2233720109548e + 20

Is it really necessary to generate so many digits?


------ Solution --------------------
The upstairs are all broken...
For your problem: the second
------ Solution --------------------
Of course it's the second type!
Although mysql provides the find_in_set function to easily lift members from Comma-separated strings, it takes some time to execute the function.
How can it be faster than direct reading?

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.