Java export Excel

preface

As we all know, excel is divided into two steps:

These two steps are time-consuming. Generally, we check the data from the database, then assemble the data, and finally write the data.

Data query is not the focus of this section, but mainly SQL and index, which are not discussed here. This section focuses on writing data.

problem

When the amount of data is small (for example, tens of thousands of pieces), synchronization can be adopted without considering anything else.

When the amount of data is large (for example, tens of millions), the problem is exposed.

First of all, slow is certain. At least tens of seconds, more than tens of minutes are possible.

This is still a small problem. The most fatal thing is that an export has hung up the system...

I have seen that because of an export, the system hangs directly, which seriously slows down other applications on the same machine, and finally goes down...

The reason is that a large amount of data accumulated in memory may cause memory overflow. To exaggerate, millions of data and dozens of fields of each data are put into memory, which will not be released until all of them are written.

programme

proposal

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>