Benchmark for this
Use the imported data totally. Not keep old data.
The are two way to do this:
- override
before_import
andget_or_init_instance
. - using the new option:
bulk_repace
in file myapp/admin.py,
ResourceTestModel_1
is the first way.
ResourceTestModel_2
is the second way.
TestModel-2016-06-20.xls
is the test data which contains 10K rows.
using mysql database. (pymysql
as driver).
this is the runserver log:
- First way
[TIME MEASURE] /admin/myapp/testmodel/import/: 11.0680501461
[20/Jun/2016 10:16:32] "POST /admin/myapp/testmodel/import/ HTTP/1.1" 200 5599231
[TIME MEASURE] /admin/myapp/testmodel/process_import/: 96.4507160187
[20/Jun/2016 10:18:20] "POST /admin/myapp/testmodel/process_import/ HTTP/1.1" 302 0
[TIME MEASURE] /admin/myapp/testmodel/: 0.127159118652
[20/Jun/2016 10:18:20] "GET /admin/myapp/testmodel/ HTTP/1.1" 200 46114
Total cost 107 seconds.
- Second way
[TIME MEASURE] /admin/myapp/testmodel/import/: 1.76946806908
[20/Jun/2016 10:19:20] "POST /admin/myapp/testmodel/import/ HTTP/1.1" 302 0
[TIME MEASURE] /admin/myapp/testmodel/: 0.116591215134
[20/Jun/2016 10:19:20] "GET /admin/myapp/testmodel/ HTTP/1.1" 200 45954
Total cost 1.8 seconds.