Snowflake Optima

Snowflake Optima 通过对工作负载优化采用智能化方法,扩展了 Snowflake 核心的性能和简化原则。与需要手动调优不同,Snowflake Optima 会持续分析工作负载模式,并自动实施最有效的策略。Snowflake Optima 确保查询运行更快、成本更低,而无需额外配置或维护。通过预测并适应 SQL 工作负载的不断变化,Snowflake Optima 会自动提升性能。

备注

  • Snowflake Optima is included in all Snowflake editions.

  • Snowflake Optima 仅适用于 :doc:` Snowflake 第二代标准仓库 </user-guide/warehouses-gen2>`。

The following sections describe Snowflake Optima in more detail:

Optima Indexing

Optima Indexing 是 Snowflake Optima 的一项功能,它会在后台自动分析工作负载以创建和维护索引。Optima Indexing 构建于 :doc:` 搜索优化服务 </user-guide/search-optimization-service>` 之上。

通过持续监控 SQL 工作负载,Optima Indexing 可以识别提升性能的机会(例如对表的重复点查找查询),并自动生成隐藏索引以加速这些工作负载。这些索引的创建和维护遵循尽力而为原则,无需用户干预。

Optima Indexing 不产生额外费用,并且由于它与 Snowflake 完全集成,无需额外配置即可享受性能提升。

对于需要保证性能的专用工作负载(例如网络安全行业的威胁检测),您仍可以直接应用搜索优化。此选项可提供一致的索引实时性,从而在对近实时结果至关重要的场景中实现稳定的性能。

Optima Metadata

Optima Metadata is a Snowflake Optima feature that automatically optimizes your workloads without any user input. Snowflake Optima analyzes your query patterns, identifies inefficient usage of columns in pruning, and creates additional metadata to optimize these queries. Even if you don't know all the nuances of Snowflake's query engine, Optima still ensures that you prune unused micro-partitions as effectively as possible.

For example, one of the scenarios that Snowflake Optima has optimized is usage of the UPPER and LOWER functions in the WHERE clause. These functions are inefficient in pruning. So, if Snowflake Optima observes frequent use of these functions in your query filter predicates, it automatically creates metadata to aid in pruning.

In general, the best practice is to avoid scenarios that lead to inefficient pruning. However, Snowflake Optima can improve performance when these scenarios occur. That is, you should continue to follow all existing query performance best practices and think of Optima Metadata as a feature that works in the background to catch optimizations you might have missed.

Monitor Snowflake Optima use

您可以在 Snowsight 中 Query History 下 :ref:` Query Profile 标签页 <label-snowsight_query_profile>` 的以下面板监控 Snowflake Optima 的使用情况:

You can also monitor Snowflake Optima use by querying the QUERY_INSIGHTS 视图. For more information about query insights, see 使用查询见解提高性能.

Query insights 窗格

The Query insights pane displays each type of insight detected for a query and lists each instance of that insight type.

  • To learn more about the condition that was detected, select View next to an entry in the Query insights pane.

If Snowflake Optima was used to optimize the given query, Snowflake Optima used appears and the details are displayed.

下图示例展示了 Query insights 窗格,指示 Snowflake Optima 已被使用:

显示 Query Profile 标签页的 Query Insights 窗格。

Statistics 窗格

要查看 Snowflake Optima 的裁剪统计信息,请打开 Query Profile 标签页上的 Statistics 窗格。查找标记为 Partitions pruned by Snowflake Optima 的行。此行显示查询执行过程中跳过的分区数量,说明 Snowflake Optima 通过减少扫描数据量提升了性能。

The following image shows an example of the Statistics pane that indicates that Snowflake Optima was used:

显示 Query Profile 标签页的 Statistics 窗格。