With data pipeline tools and the expressiveness of SQL, managing interdependent materialized views (MVs) are becoming increasingly easy. These MVs are updated repeatedly upon new data ingestion (e.g., daily), from which database admins can observe performance metrics (e.g., refresh time of each MV, size on disk) in a consistent way for different types of updates (full vs. incremental) and for different systems (single node, distributed, cloud-hosted). One missed opportunity is that existing data systems treat those MV updates as independent SQL statements without fully exploiting their dependency information and performance metrics. However, if we know that the result of a SQL statement will be consumed immediately after for subsequent operations, those subsequent operations do not have to wait until the early results are fully materialized on storage because the results are already readily available in memory. Of course, this may come at a cost because keeping results in memory (even temporarily) will reduce the amount of available memory; thus, our decision should be careful. In this paper, we introduce a new system, called S/C, which tackles this problem through efficient creation and update of a set of MVs with acyclic dependencies among them. S/C judiciously uses bounded memory to reduce end-to-end MV refresh time by short-circuiting expensive reads and writes; S/C's objective function accurately estimates time savings from keeping intermediate data in memory for particular periods. Our solution jointly optimizes an MV refresh order, what data to keep in memory, and when to release data from memory. At a high level, S/C still materializes all data exactly as defined in MV definitions; thus, it doesn't impact any service-level agreements. In our experiments with TPC-DS datasets (up to 1TB), we show S/C's optimization can speedup end-to-end runtime by 1.04x-5.08x with 1.6GB memory.
翻译:随着数据管道工具和SQL表达能力的提升,管理相互依赖的物化视图(MV)正变得日益便捷。这些物化视图在新数据摄入后(如每日)会被重复更新,数据库管理员可以据此以统一方式观测不同更新类型(全量vs增量)和不同系统(单节点、分布式、云托管)的性能指标(如各物化视图的刷新时间、磁盘占用大小)。现有数据系统的一个错失机遇在于,它们将这些物化视图更新视为独立的SQL语句,而未充分利用其依赖关系和性能指标。然而,若已知某SQL语句的结果将立即被后续操作消费,则后续操作无需等待早期结果完全物化至存储,因为这些结果已在内存中即时可用。当然,这可能带来代价——将结果保留在内存中(即使暂存)会减少可用内存量,因此需谨慎决策。本文提出名为S/C的新系统,通过高效创建和更新一组具有无环依赖关系的物化视图来解决此问题。S/C利用有限内存,通过短路昂贵的读写操作来缩短端到端的物化视图刷新时间;其目标函数能精确估算将中间数据保留特定时长于内存中所节省的时间。我们的解决方案联合优化了物化视图刷新顺序、内存驻留数据的选择以及数据释放时机。从高层次看,S/C仍按物化视图定义物化所有数据,因此不影响任何服务等级协议。在TPC-DS数据集(最高1TB)的实验表明,S/C的优化在1.6GB内存下可使端到端运行时间加速1.04倍至5.08倍。