Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-1677

Mongoimport --mode merge dramatically slower than --mode insert

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.2
    • Component/s: mongoimport
    • Labels:
    • Environment:
      osx

      I found that the difference between loading the attached file of unremarkable documents with -mode merge versus without (i.e. with the default -mode insert was over a hundred-fold increase in duration.

      17:13:32 III > time mongoimport --drop --mode merge cat100
      2017-06-02T17:13:55.008+1000	no collection specified
      2017-06-02T17:13:55.008+1000	using filename 'cat100' as collection
      2017-06-02T17:13:55.019+1000	connected to: localhost
      2017-06-02T17:13:55.020+1000	dropping: test.cat100
      2017-06-02T17:13:58.012+1000	[#.......................] test.cat100	89.2KB/1.31MB (6.6%)
      2017-06-02T17:14:01.011+1000	[##......................] test.cat100	157KB/1.31MB (11.7%)
      2017-06-02T17:14:04.011+1000	[###.....................] test.cat100	224KB/1.31MB (16.7%)
      2017-06-02T17:14:07.012+1000	[#####...................] test.cat100	281KB/1.31MB (20.9%)
      2017-06-02T17:14:10.012+1000	[######..................] test.cat100	340KB/1.31MB (25.3%)
      2017-06-02T17:14:13.013+1000	[#######.................] test.cat100	406KB/1.31MB (30.2%)
      2017-06-02T17:14:16.013+1000	[########................] test.cat100	473KB/1.31MB (35.2%)
      2017-06-02T17:14:19.013+1000	[#########...............] test.cat100	538KB/1.31MB (40.0%)
      2017-06-02T17:14:22.011+1000	[##########..............] test.cat100	603KB/1.31MB (44.9%)
      2017-06-02T17:14:25.011+1000	[###########.............] test.cat100	671KB/1.31MB (50.0%)
      2017-06-02T17:14:28.012+1000	[#############...........] test.cat100	737KB/1.31MB (54.8%)
      2017-06-02T17:14:31.009+1000	[##############..........] test.cat100	806KB/1.31MB (60.0%)
      2017-06-02T17:14:34.010+1000	[###############.........] test.cat100	875KB/1.31MB (65.1%)
      2017-06-02T17:14:37.013+1000	[################........] test.cat100	944KB/1.31MB (70.2%)
      2017-06-02T17:14:40.012+1000	[##################......] test.cat100	1012KB/1.31MB (75.3%)
      2017-06-02T17:14:43.009+1000	[###################.....] test.cat100	1.05MB/1.31MB (80.4%)
      2017-06-02T17:14:46.013+1000	[####################....] test.cat100	1.12MB/1.31MB (85.5%)
      2017-06-02T17:14:49.012+1000	[#####################...] test.cat100	1.19MB/1.31MB (90.8%)
      2017-06-02T17:14:52.011+1000	[######################..] test.cat100	1.26MB/1.31MB (95.6%)
      2017-06-02T17:14:55.012+1000	[########################] test.cat100	1.31MB/1.31MB (100.0%)
      2017-06-02T17:14:55.744+1000	[########################] test.cat100	1.31MB/1.31MB (100.0%)
      2017-06-02T17:14:55.745+1000	imported 2470 documents
      
      real	1m0.771s
      user	0m0.692s
      sys	0m0.305s
      
      
      
      III > time mongoimport --drop --mode insert cat100
      2017-06-02T17:19:48.741+1000	no collection specified
      2017-06-02T17:19:48.741+1000	using filename 'cat100' as collection
      2017-06-02T17:19:48.744+1000	connected to: localhost
      2017-06-02T17:19:48.744+1000	dropping: test.cat100
      2017-06-02T17:19:49.231+1000	imported 2470 documents
      
      real	0m0.504s
      user	0m0.128s
      sys	0m0.046s
      
      

            Assignee:
            david.golden@mongodb.com David Golden
            Reporter:
            william.byrne@mongodb.com William Byrne III
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: