user1163513
user1163513

Reputation: 4217

How to speed up exporting large Excel file using php and SQL Server

I am trying to export Excel in php having more than 100k records but it took more than an hour to export the record set.

I am using SQL Server as my database.

Is there any way to speed up the entire process?

Upvotes: 0

Views: 1544

Answers (1)

Mihai Stancu
Mihai Stancu

Reputation: 16127

One option would be to make sure you minimize disk IO which means grouping multiple writes to the file into one batch. Such as writing 100 records at once not just 1.

This is easily possible if you're writing CSV files but I'm not sure if the PHP Excell library you're using exposes this implementation detail.

One other option would be saving your file in a RamDisk Drive, a small filesystem allocated in ram and mapped as a disk drive.

On Unix/Linux platforms /dev/shm is a shared memory filesystem. Reading/Writing stuff from it is much much faster than HDD disk IO.

If you're using Windows i remember there were some RamDisk solutions. You'd have to download some 3rd party software that implements a windows disk driver.

Upvotes: 1

Related Questions