@@ -250,24 +250,25 @@ these fields to determine whether the command returned stale data.
250250-----------
251251
252252For :manual:`explain </reference/command/explain>` command, the data
253- returned by ``explain`` documents the |data-lake| query plan, and
254- differs from MongoDB in that it provides information about the data
255- partitions used to satisfy the query.
253+ returned by ``explain`` documents the |data-lake| query plan. The
254+ ``explain`` output differs from MongoDB in that it provides information
255+ about the data partitions used to satisfy the query.
256256
257- The following commands are explainable in |data-lake|:
257+ The following commands can be explained in |data-lake|:
258258
259259- ``aggregate()``
260260- ``count()``
261261- ``find()``
262262
263- The following ``verbosity`` modes are supported :
263+ {+adl+} supports the following ``verbosity`` modes:
264264
265265- ``queryPlanner`` - provides information on the query plan.
266266- ``queryPlannerExtended`` - provides detailed information on the query
267267 plan including information about the |s3| objects, such as the |s3|
268268 object names and sizes, that will be queried.
269269
270- The ``executionStats`` and ``allPlansExecution`` modes aren't supported.
270+ {+adl+} doesn't support ``executionStats`` and ``allPlansExecution``
271+ modes.
271272
272273.. example::
273274
@@ -281,6 +282,110 @@ The ``executionStats`` and ``allPlansExecution`` modes aren't supported.
281282
282283 db.runCommand({ "explain": { "aggregate": "user", "verbosity": "queryPlannerExtended", "pipeline": [ ], "cursor": {} }})
283284
285+ When you run ``explain``, {+adl+} returns the following fields:
286+
287+ .. list-table::
288+ :header-rows: 1
289+ :widths: 30 70
290+
291+ * - Output Field Name
292+ - Description
293+
294+ * - ``stats``
295+ - Document that describes the number and total size of partitions
296+ that {+adl+} might open for the query.
297+
298+ * - ``stats.size``
299+ - Total size of partitions that {+adl+} might open for the query.
300+
301+ * - ``stats.numberOfPartitions``
302+ - Number of partitions that {+adl+} might open for the query.
303+
304+ * - ``plan``
305+ - Document that contains the query execution plan for the query.
306+ The document contains nested execution plan nodes, each of which
307+ is a document describing the plan node. The nested plan node
308+ documents contain internal description of {+adl+}'s query
309+ execution, and include various node kinds that are subject to
310+ change. Contact MongoDB support if you need more help with
311+ understanding the query plan.
312+
313+ .. tabs::
314+
315+ .. tab:: Basic Example
316+ :tabid: basiceg
317+
318+ .. io-code-block::
319+
320+ .. input::
321+ :language: shell
322+
323+ db.runCommand({ "explain": { "aggregate": "user", "verbosity": "queryPlanner", "pipeline": [ ], "cursor": {} }})
324+
325+ .. output::
326+ :linenos:
327+
328+ {
329+ ok: 1,
330+ stats: { size: '42.06258487701416 MiB', numberOfPartitions: 1 },
331+ plan: {
332+ kind: 'region',
333+ region: 'AWS/us-east-1',
334+ node: {
335+ kind: 'data',
336+ size: '42.06258487701416 MiB',
337+ numberOfPartitions: 1,
338+ partitions: [ { source: 'sbx', provider: 'atlas', size: '42.06258487701416 MiB' } ]
339+ }
340+ }
341+ }
342+
343+ .. tab:: find Example
344+ :tabid: findeg
345+
346+ .. io-code-block::
347+
348+ .. input::
349+ :language: shell
350+
351+ db.movies.explain().find({"type": "movie", "year": {$gt: 2010, $lt: 2015} }, {"title": 1, "year": 1 })
352+
353+ .. output::
354+ :linenos:
355+
356+ {
357+ ok: 1,
358+ stats: { size: '36.06258487701416 MiB', numberOfPartitions: 1 },
359+ plan: {
360+ kind: 'region',
361+ region: 'AWS/us-east-1',
362+ node: {
363+ kind: 'data',
364+ size: '36.06258487701416 MiB',
365+ numberOfPartitions: 1,
366+ partitions: [
367+ {
368+ source: 'sbx',
369+ provider: 'atlas',
370+ size: '36.06258487701416 MiB',
371+ pipeline: [
372+ {
373+ '$match': {
374+ '$and': [
375+ { year: { '$lt': 2015 } },
376+ { year: { '$gt': 2010 } },
377+ { type: { '$eq': 'movie' } }
378+ ]
379+ }
380+ },
381+ { '$project': { title: 1, year: 1 } }
382+ ]
383+ }
384+ ]
385+ }
386+ }
387+ }
388+
284389``getLog``
285390----------
286391
0 commit comments