How to improve the efficiency of phpexcel export (note: cvs format can be ignored, this export has cell operation operations)
What I am thinking of now is:
Optimizing SQL now has an interface for data details. Now it is to get the ID array of the data to loop through the project details interface to extract the required fields
I haven’t thought of any other good methods at the moment, so please give me some advice.
The performance of phpExcel is very poor and takes up memory. This will generally limit the number of exported rows. If you don’t think too much about style, you can use the t method to export excel,
Give me an example
Our company currently uses t to export excel data, and its performance is better than phpExcel. The questioner can test the performance ratio
1. It’s easy to optimize without relying on phpexcel. In fact, you don’t need many function methods. And it also needs to load
2.sql query is also an optimization. I won’t talk about this without seeing the code.
3. When you extract too much data from sql, it actually takes up a lot of php memory, so it is recommended to clear the data immediately after writing it to excel.
Excel becomes slow when writing a certain amount of data. . This is normal
Use the queue to asynchronously execute the import and export of
PHPExcel
, especially when executing tens of thousands, hundreds of thousands or even millions of dataImport and export in batches
Optimize code and minimize database access