Sometimes it is necessary to independently process a large amount of data in the database. At this time, you can write your own code to process the data, but the execution consumes a lot of resources, basically, all other functions of the website are stuck there and cannot be moved. Do you have any good solutions? The actual situation is like this, public... sometimes it is necessary to independently process a large amount of data in the database. At this time, you can write your own code to process the data, but the execution consumes a lot of resources, basically, all other functions of the website are stuck there and cannot be moved. Do you have any good solutions?
The actual situation is that Company A has telephone recording files, which must be associated with users in system B, the file name of the recording file contains the user's phone number. You can use the phone number to search for the customer ID in the database of system B, and then associate it with a total of tens of thousands of call records. PHP writes a piece of code for processing, but once executed, other functions of the system become stuck and cannot be moved.
Reply content:
Sometimes it is necessary to independently process a large amount of data in the database. At this time, you can write your own code to process the data, but the execution consumes a lot of resources, basically, all other functions of the website are stuck there and cannot be moved. Do you have any good solutions?
The actual situation is that Company A has telephone recording files, which must be associated with users in system B, the file name of the recording file contains the user's phone number. You can use the phone number to search for the customer ID in the database of system B, and then associate it with a total of tens of thousands of call records. PHP writes a piece of code for processing, but once executed, other functions of the system become stuck and cannot be moved.
In this case, most of the results may be caused by SQL statement performance problems. You can try to optimize your SQL statements by referring to the previous article: The best 20 + MySQL performance optimization experience.
I don't know if this is an automatic task or? If it is an automatic task, we recommend that you execute it in the middle of the night when there is a small amount of user traffic. If not, I don't know if it is too many reads or writes? Write too much. You probably have locked the table.
Optimize Your SQL. First, determine the bottleneck? It is generally not in PHP.
When talking to a friend, I suddenly thought that the recording file contains the recording time, and each recording has the corresponding service information submitted to the system, then, you can first collect the time of these Recording files, sort them, retrieve the time period, and then read the user_id of the corresponding service record during the time period, and associate it with the phone number, then perform file operations, which can greatly reduce the frequency of accessing the database.
This is probably the right idea.