MySQL user table data statistics, please give us the best, feasible solution.

Source: Internet
Author: User
MySQL user table has 900,000 records, each record only the user's registered IP address, now want to according to the registered province, statistics of how many registered users in each province, please give the best, feasible plan?

Reply content:

MySQL user table has 900,000 records, each record only the user's registered IP address, now want to according to the registered province, statistics of how many registered users in each province, please give the best, feasible plan?

1. Get province information via IP: http://www.ipip.net/api.html.
2.90W data, add an index to the province, and then regular statistics on the good, this statistic is not necessary to run frequently.
3. Such data is larger, you can consider the number of new registered users per day in the cache alone, with the total number of old + daily new number is OK.
4. The data is bigger, bigger and bigger ... (Wait till you get to that level.)

PS: This has no way, IP this thing is more chaotic, can own statistics which IP segment is the same province, this can reduce the query API. You want to follow the provinces, this field of the province cannot be omitted. Also, you change the registration, register the province, this way is to use the IP or the user to fill in your own decision. By the way, Gao Chunhui's ipip.net don't like to run data on them. The last time I saw him on a microblog, he was annoyed by it.

  • 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.