Introduction to MongoDB
1.0 - draft
1.0 - draft
  • MongoDB
  • Getting Started
    • General
      • Database? Collection? Schema?
      • RDBMS? NoSQL?
      • Scale-Up ? Scale - out?
      • JavaScript Object Notation
    • MongoDB
      • 간략한 역사,
    • Manipulating Database
      • MongoShell
      • PyMongo
  • CRUD
    • General
      • Explain()
      • mongoimport
    • Create
      • Mongo Shell
      • PyMongo
      • Exercises
    • Read
      • Mongo Shell
      • PyMongo
      • Exercises
    • Update
      • Mongo Shell
      • PyMongo
      • Exercises
    • Delete
      • PyMongo
      • Exercises
    • Challenging Exercises
      • Exercise 1
  • Index with Geospatial & Text
    • Basic Index
      • Syntax
      • Exercises
    • Geospatial Index
      • Syntax
      • Exercises
    • Text Index
      • Syntax
      • Exercises
    • Challenge
  • Aggregate framework
    • Aggregate Framework
      • Basic
      • Exercises
  • Distributed
    • Replication
      • Setup
        • Configuration File
        • Running Servers
        • Initiation
        • Exercises
      • Concerns
        • Read Concern
        • Write Concern
        • Exercises
    • Sharding
      • Getting Started
      • Setup
  • MongoDB 4.0 Features
    • Multi-Document Transaction
      • Transaction?
      • Basic
      • Exercises
  • Administration
    • Untitled
Powered by GitBook
On this page
  • explain() in MongoShell
  • explain() in PyMongo
  • Exercise

Was this helpful?

  1. CRUD
  2. General

Explain()

Explain은 대부분 데이터베이스 시스템에서 지원을 해주는 기능이다. 사용자의 질의문 (query)을 데이터베이스의 optimizer가 query plan을 통해서 실행하는 것을 보여주는 것이다.

  • Provides information on the query plan for find() method.

  • In PyMongo, explain() returns a dictionary. Use a key, ‘executionStats’.

  • Example

explain() in MongoShell

db.mycollection.find().explain()

explain() in PyMongo

mycollection.find().explain()
mycollection.find().explain()[‘executionStats’]

Exercise

  • Print a query plan using executionStats corresponding to the query that finds writer, Kim.

  • Using blog.json

 "executionStats" : {
…
                "executionTimeMillis" : 0,
                "totalKeysExamined" : 0,
                "totalDocsExamined" : 4,
                "nReturned": 1,
                "executionStages": {
                               "stage": "COLLSCAN",
…

PreviousGeneralNextmongoimport

Last updated 5 years ago

Was this helpful?