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