估计MongoDB Atlas Data Lake的查询影响



是否有一种方法可以估计查询读取的数据成本/数据量,而无需实际运行?

类似于Google的大查询--dry_run标志

我不相信目前有这样的功能。但是,您可以在查询上运行explain(),例如db.airbnb.explain().find(....)。查询计划应显示包含大小的节点url,例如:

> db.airbnb.explain().find({ "address.market" : "New York", "price": {$lt: NumberDecimal("200.00")} } )
{
  "ok" : 1,
  "plan" : {
    "kind" : "multiPlanNode",
    "regionPlans" : {
      "2/ap-southeast-2" : {
....
        "node" : {
          "kind" : "data",
          "partitions" : [
            {
              "url" : "s3://xxxx/json/airbnb/listingsAndReviews.json?agentRegion=2%2Fap-southeast-2&format=.json&region=ap-southeast-2&size=92.65681457519531+MiB",
              "attributes" : {
              }
            }
....

请注意:

"url" : "s3://xxxx/json/airbnb/listingsAndReviews.json?agentRegion=2%2Fap-southeast-2&format=.json&region=ap-southeast-2&size=92.65681457519531+MiB"

表示查询将读取S3 URL,即92 MB。

edit :正如@willis所指向的,在没有任何参数的情况下运行explain() not not 实际运行查询,但只会显示执行计划(请参阅Invellive((行为(。但是,使用explain('executionStats'),查询实际上将被执行。

最新更新