Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-7092

Delete by query is really slow

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.7
    • Component/s: None
    • Labels:
      None
    • Environment:
      ubuntu 12.04,
      Hardware: Intel(R) Xeon(R) CPU E5606 @ 2.13GHz', 2133MHz, 4 Core, Sockets: 2
      RAM: 32230MB
      RAID: Level 10 Disks: 4 Size: 1849GB Type: SATA
    • Linux

      Trying to delete approx 8m of a 21million collection, its taking ages & appears to be very slow.

      I am running a js file locally on server (mongo localhost:27018 remove.js) that contains:
      collection.remove({'dts':{'$gte':ISODate('2012-06-21T00:00:00Z')}});

      I only have two indexes.
      one on _id.
      one on above date field & id.

      Disk I/O is maxxed out at 100%, please see attached iostat file.

      I have an MMS account, please let me know what further details you need if you can look at it, the server is currently running the delete operation.

      I also have another shard that I am also doing a delete on, but instead trying out with
      var c = collection.find({'dts':{'$gte':ISODate('2012-06-21T00:00:00Z')}},

      {'_id':1}

      );
      and
      c.forEach(function (id) { cursor.remove({_id: id._id});})

      It's also maxxing out I/O at 100% with a very slow return on deletes/sec.

      Is there a recommended way to delete a large quantity of items?
      Am I doing something blatantly wrong?

        1. iostat_-xmdh_2.txt
          3 kB
        2. mongostat_server1.txt
          6 kB
        3. mongostat_server2.txt
          7 kB

            Assignee:
            stephen.lee Stephen Lee
            Reporter:
            steve@buzznumbershq.com Steven Casey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: