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

Query don't use index

    • Type: Icon: Bug Bug
    • Resolution: Incomplete
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.5
    • None
    • ALL
    • Hide

      Randomly with high load on slave or master.
      DB: 33G, replset (1master - 2slaves).
      3x servers: EC2 m4.large (8Gb RAM)

      Show
      Randomly with high load on slave or master. DB: 33G, replset (1master - 2slaves). 3x servers: EC2 m4.large (8Gb RAM)

      Randomly the query (slave or master) stop to use an index and start to scan the collection.

      Here is an extract of the db.currentOp:

      		{
      			"desc" : "conn206",
      			"threadId" : "0x65818e0",
      			"connectionId" : 206,
      			"opid" : 38888384,
      			"active" : true,
      			"secs_running" : 131,
      			"microsecs_running" : NumberLong(131062659),
      			"op" : "query",
      			"ns" : "prod.cart",
      			"query" : {
      				"orderby" : {
      					"_id" : 1
      				},
      				"$query" : {
      					"offer" : "OFFER1",
      					"code" : "CODE2",
      					"customerId" : ObjectId("55c82exxxxxxxxxxx")
      				}
      			},
      			"planSummary" : "IXSCAN { code: 1 }, IXSCAN { code: 1 }",
      			"client" : "172.x.x.x:52977",
      			"numYields" : 6191,
      			"locks" : {
      				"Global" : "r",
      				"MMAPV1Journal" : "r",
      				"Database" : "r",
      				"Collection" : "R"
      			},
      			"waitingForLock" : false,
      			"lockStats" : {
      				"Global" : {
      					"acquireCount" : {
      						"r" : NumberLong(12384)
      					},
      					"acquireWaitCount" : {
      						"r" : NumberLong(831)
      					},
      					"timeAcquiringMicros" : {
      						"r" : NumberLong(7836539)
      					}
      				},
      				"MMAPV1Journal" : {
      					"acquireCount" : {
      						"r" : NumberLong(6192)
      					},
      					"acquireWaitCount" : {
      						"r" : NumberLong(27)
      					},
      					"timeAcquiringMicros" : {
      						"r" : NumberLong(204897)
      					}
      				},
      				"Database" : {
      					"acquireCount" : {
      						"r" : NumberLong(6192)
      					}
      				},
      				"Collection" : {
      					"acquireCount" : {
      						"R" : NumberLong(6192)
      					}
      				}
      			}
      		}
      

      Index:

      [
      	{
      		"v" : 1,
      		"key" : {
      			"_id" : 1
      		},
      		"name" : "_id_",
      		"ns" : "prod.Cart"
      	},
      	{
      		"v" : 1,
      		"key" : {
      			"customerId" : 1
      		},
      		"name" : "customerId_1",
      		"ns" : "prod.Cart"
      	},
      	{
      		"v" : 1,
      		"key" : {
      			"code" : 1
      		},
      		"name" : "code_1",
      		"ns" : "prod.Cart"
      	},
      	{
      		"v" : 1,
      		"key" : {
      			"offer" : 1
      		},
      		"name" : "offer_1",
      		"ns" : "prod.Cart",
      		"background" : true
      	}
      ]
      

            Assignee:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Reporter:
            support@sesam.hk SHUK LING
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: