Python Crawler Bulk Data Cleansing----SQL statement optimization

Source: Internet
Author: User

1 The description of the problem is that     when doing the crawler, the data volume is very large, about BESPA data, assuming that there is a field conmany_name (auction company name), we now need to find out from 5 million data in 50 auction companies,
The field is required to be longer than July 1 and less than October 31.
2         The solution we first think of is to add an index to the auction company field, but because the date is greater than July 1, less than October 31, where the index is inefficient,
and to repeat the query out of 50 companies, the efficiency is very low, there is no good solution???
3 . Problem-solving    ideas 1 Query 500 data, we will find that the memory is not enough, at this time we only query 1 million data, divided into five processing completed.     2 because these 1 million data are in memory, the 1 million data is put into the list, and the 50 auction companies are combined into strings, and for loop each piece of data,
Compare whether the auction company is in a string and the comparison date is greater than July 1, less than October 31. This is done to avoid slow data queries. Improve data processing efficiency.
4. Impressions: Good problem-solving ideas outweigh good problem-solving people

Python Crawler Bulk Data Cleansing----SQL statement optimization

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.