数据模型详解-究竟什么时候物化视图?

2018-05-04 10:47:37 浏览数 (1)

翻译内容

3.4. Materialized Views 第三段和第四段:

Views provide a mechanism to hide from the client whether data is derived data or base data—but can’t avoid the fact that some views are expensive to compute.

视图提供了一种机制就是把数据封装起来,然后客户端调用者不管是原始数据(base data)还是派生数据(derived data)——但是呢,有些视图的计算量很大。

To cope with this, materialized views were invented, which are views that are computed in advance and cached on disk. Materialized views are effective for data that is read heavily but can stand being somewhat stale.

为了解决这个问题,物化视图就被发明了,物化视图是个什么鬼呢?其实就是把计算的过程提前干了,然后把计算结果存到磁盘上,这样的视图我们就叫“物化视图”(materialized views)。物化的view适合那种读取比较频繁但不介意数据略显stale的情况。

Although NoSQL databases don’t have views, they may have precomputed and cached queries, and they reuse the term “ materialized view” to describe them.

尽管我们的nosql数据库呢并没有视图这个概念,但我们也把在nosql里边的这种“预先计算然后把结果存起来”的情况,也用“物化视图”这个词来描述,其实就是俺们也有物化视图的意思啦。

It’ s also much more of a central aspect for aggregate-oriented databases than it is for relational systems, since most applications will have to deal with some queries that don’t fit well with the aggregate structure. (Often, NoSQL databases create materialized views using a map-reduce computation, which we’ll talk about inChapter 7.)

况且以面向聚合著称的nosql数据库比关系数据库更迫切的需要这个功能。因为我们在使用nosql数据库的时,大部分时候的查询操作都与我们的聚合结构不太相符,不太登对。所以nosql迫切的需要“物化”啊!(nosql数据库通常使用mr模型来做物化,这个事情会在第七章的时候会说到)

--------

以上是文字内容,如果你想聆听视频版,可以点击下面的“阅读原文”观看!

附:本文词汇:

To cope with this:为了解决这个问题

base data:原始数据

derived data:派生数据,就是经过计算后得出的结果。

materialized view:其实就是持久化查询结果,你可以这样认为。

0 人点赞