Query optimization is crucial for every DBMS to enable fast execution of declarative queries. While most DBMS designs include cost-based query optimization, MongoDB chooses an execution plan by what we call “first past the post” (FPTP) query optimization. This partially executes the alternative plans in a round-robin race and observes the work done by each relative to the number of records returned. Through experiments, we analyze the effectiveness of MongoDB’s FPTP query optimizer, concluding that it chooses index scans even in many cases where collection scans would run faster. We identify the reasons for this.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

First Past the Post: Evaluating Query Optimization in MongoDB

  • Dawei Tao,
  • Enqi Liu,
  • Sidath Randeni Kadupitige,
  • Michael Cahill,
  • Alan Fekete,
  • Uwe Röhm

摘要

Query optimization is crucial for every DBMS to enable fast execution of declarative queries. While most DBMS designs include cost-based query optimization, MongoDB chooses an execution plan by what we call “first past the post” (FPTP) query optimization. This partially executes the alternative plans in a round-robin race and observes the work done by each relative to the number of records returned. Through experiments, we analyze the effectiveness of MongoDB’s FPTP query optimizer, concluding that it chooses index scans even in many cases where collection scans would run faster. We identify the reasons for this.