First Past the Post: Evaluating Query Optimization in MongoDB

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Tao, Dawei, Liu, Enqi, Kadupitige, Sidath Randeni, Cahill, Michael, Fekete, Alan, Röhm, Uwe
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866909325291683840
author Tao, Dawei
Liu, Enqi
Kadupitige, Sidath Randeni
Cahill, Michael
Fekete, Alan
Röhm, Uwe
author_facet Tao, Dawei
Liu, Enqi
Kadupitige, Sidath Randeni
Cahill, Michael
Fekete, Alan
Röhm, Uwe
contents Query optimization is crucial for every database management system (DBMS) to enable fast execution of declarative queries. Most DBMS designs include cost-based query optimization. However, MongoDB implements a different approach to choose an execution plan that we call "first past the post" (FPTP) query optimization. FPTP does not estimate costs for each execution plan, but rather partially executes the alternative plans in a round-robin race and observes the work done by each relative to the number of records returned. In this paper, we analyze the effectiveness of MongoDB's FPTP query optimizer. We see whether the optimizer chooses the best execution plan among the alternatives and measure how the chosen plan compares to the optimal plan. We also show how to visualize the effectiveness and identify situations where the MongoDB 7.0.1 query optimizer chooses suboptimal query plans. Through experiments, we conclude that FPTP has a preference bias, choosing index scans even in many cases where collection scans would run faster. We identify the reasons for the preference bias, which can lead MongoDB to choose a plan with more than twice the runtime compared to the optimal plan for the query.
format Preprint
id arxiv_https___arxiv_org_abs_2409_16544
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle First Past the Post: Evaluating Query Optimization in MongoDB
Tao, Dawei
Liu, Enqi
Kadupitige, Sidath Randeni
Cahill, Michael
Fekete, Alan
Röhm, Uwe
Databases
Query optimization is crucial for every database management system (DBMS) to enable fast execution of declarative queries. Most DBMS designs include cost-based query optimization. However, MongoDB implements a different approach to choose an execution plan that we call "first past the post" (FPTP) query optimization. FPTP does not estimate costs for each execution plan, but rather partially executes the alternative plans in a round-robin race and observes the work done by each relative to the number of records returned. In this paper, we analyze the effectiveness of MongoDB's FPTP query optimizer. We see whether the optimizer chooses the best execution plan among the alternatives and measure how the chosen plan compares to the optimal plan. We also show how to visualize the effectiveness and identify situations where the MongoDB 7.0.1 query optimizer chooses suboptimal query plans. Through experiments, we conclude that FPTP has a preference bias, choosing index scans even in many cases where collection scans would run faster. We identify the reasons for the preference bias, which can lead MongoDB to choose a plan with more than twice the runtime compared to the optimal plan for the query.
title First Past the Post: Evaluating Query Optimization in MongoDB
topic Databases
url https://arxiv.org/abs/2409.16544