What is the fastest way to load an XML file into MySQL using C#?

后端 未结 8 1059
独厮守ぢ
独厮守ぢ 2020-12-15 09:19

Question

What is the fastest way to dump a large (> 1GB) XML file into a MySQL database?

Data

The data in question is the StackOverflow Creative

8条回答
  •  青春惊慌失措
    2020-12-15 09:41

    I have a few thoughts to help speed this up...

    1. The size of the query may need to be tweaked, there's often a point where the big statement costs more in parsing time and so becomes slower. The 500 may be optimal, but perhaps it is not and you could tweak that a little (it could be more, it could be less).

    2. Go multithreaded. Assuming your system isn't already flatlined on the processing, you could make some gains by having breaking up the data in to chunks and having threads process them. Again, it's an experimentation thing to find the optimal number of threads, but a lot of people are using multicore machines and have CPU cycles to spare.

    3. On the database front, make sure that the table is as bare as it can be. Turn off any indexes and load the data before indexing it.

提交回复
热议问题