Skip to content

Commit 625a76b

Browse files
(DOCSP-22450): Add clearer disambiguation between standard / on-demand views (#1355)
* WIP * wip * (DOCSP-22450): Add clearer disambiguation between standard / on-demand views * remove broken include * add indexing behavior * more clarifications * wording * add sub-sections * add links * mild refactoring * wording * typo and wording * more wording * wording and formatting * updates per review feedback * clarify that ODM views can use out * wording
1 parent e0e68a2 commit 625a76b

File tree

4 files changed

+63
-22
lines changed

4 files changed

+63
-22
lines changed

source/core/materialized-views.txt

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,35 @@ On-Demand Materialized Views
66

77
.. default-domain:: mongodb
88

9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
915
.. meta::
1016
:description: MongoDB on-demand materialized view
1117
:keywords: MongoDB, materialized view
1218

1319
.. note:: Disambiguation
1420

15-
This page discusses on-demand materialized views, which are stored on
16-
and read from disk. For discussion of standard views, which are
17-
computed on-demand and not stored to disk, see
18-
:ref:`views-landing-page`.
19-
20-
Starting in version 4.2, MongoDB adds the :pipeline:`$merge` stage for
21-
the :doc:`aggregation pipeline </core/aggregation-pipeline>`. This
22-
stage can merge the pipeline results to an existing collection instead
23-
of completely replacing the collection. This functionality allows users
24-
to create on-demand materialized views, where the content of the output
25-
collection can be updated each time the pipeline is run.
21+
This page discusses on-demand materialized views. For discussion of
22+
standard views, see :ref:`views-landing-page`.
23+
24+
To understand the differences between the view types, see
25+
:ref:`materialized-view-compare`.
26+
27+
An on-demand materialized view is a pre-computed aggregation pipeline
28+
result that is stored on and read from disk. On-demand materialized
29+
views are typically the results of a :pipeline:`$merge` or
30+
:pipeline:`$out` stage.
31+
32+
.. _materialized-view-compare:
33+
34+
Comparison with Standard Views
35+
------------------------------
36+
37+
.. include:: /includes/views/fact-compare-view-and-materialized-view.rst
2638

2739
Example
2840
-------

source/core/views.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ You can use views to:
3939
order history. Your application can query the view without managing or
4040
understanding the underlying pipeline.
4141

42+
.. _view-materialized-view-compare:
43+
44+
Comparison with On-Demand Materialized Views
45+
--------------------------------------------
46+
47+
.. include:: /includes/views/fact-compare-view-and-materialized-view.rst
48+
4249
.. _manual-views-behavior:
4350

4451
Behavior
@@ -51,13 +58,6 @@ Read Only
5158

5259
Views are read-only. Write operations on views return an error.
5360

54-
Index Use
55-
~~~~~~~~~
56-
57-
Views use the indexes of the underlying collection. As a result, you
58-
cannot create, drop or re-build indexes on the view directly, nor get
59-
a list of indexes on the view.
60-
6161
View Pipelines
6262
~~~~~~~~~~~~~~
6363

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.. note:: Disambiguation
22

3-
This page discusses standard views, which are computed on-demand and
4-
not stored to disk. For discussion of on-demand materialized views,
5-
which are stored on and read from disk, see
6-
:ref:`manual-materialized-views`.
3+
This page discusses standard views. For discussion of on-demand
4+
materialized views, see :ref:`manual-materialized-views`.
5+
6+
To understand the differences between the view types, see
7+
:ref:`view-materialized-view-compare`.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
MongoDB provides two different view types: **standard views** and
2+
**on-demand materialized views**. Both view types return the results
3+
from an aggregation pipeline.
4+
5+
- Standard views are computed when you read the view, and are not stored
6+
to disk.
7+
8+
- On-demand materialized views are stored on and read from disk. They
9+
use a :pipeline:`$merge` or :pipeline:`$out` stage to update the saved
10+
data.
11+
12+
Indexes
13+
~~~~~~~
14+
15+
Standard views use the indexes of the underlying collection. As a
16+
result, you cannot create, drop or re-build indexes on a standard view
17+
directly, nor get a list of indexes on the view.
18+
19+
You can create indexes directly on on-demand materialized views because
20+
they are stored on disk.
21+
22+
Performance
23+
~~~~~~~~~~~
24+
25+
On-demand materialized views provide better read performance than
26+
standard views because they are read from disk instead of computed as
27+
part of the query. This performance benefit increases based on the
28+
complexity of the pipeline and size of the data being aggregated.

0 commit comments

Comments
 (0)