polars.LazyFrame.explain#
- LazyFrame.explain(
- *,
- format: ExplainFormat = 'plain',
- optimized: bool = True,
- type_coercion: bool = True,
- _type_check: bool = True,
- predicate_pushdown: bool = True,
- projection_pushdown: bool = True,
- simplify_expression: bool = True,
- slice_pushdown: bool = True,
- comm_subplan_elim: bool = True,
- comm_subexpr_elim: bool = True,
- cluster_with_columns: bool = True,
- collapse_joins: bool = True,
- streaming: bool = False,
- tree_format: bool | None = None,
- _check_order: bool = True,
创建查询计划的字符串表示。
可以开启或关闭不同的优化。
- Parameters:
- format{‘plain’, ‘tree’}
用于显示逻辑计划的格式。
- optimized
返回一个优化的查询计划。默认为
True。 如果设置为True,后续的优化标志将控制哪些优化运行。- type_coercion
进行类型强制优化。
- predicate_pushdown
执行谓词下推优化。
- projection_pushdown
执行投影下推优化。
- simplify_expression
运行简化表达式优化。
- slice_pushdown
切片下推优化。
- comm_subplan_elim
将尝试缓存出现在自连接或联合上的分支子计划。
- comm_subexpr_elim
常见的子表达式将被缓存并重复使用。
- cluster_with_columns
将连续的独立调用合并到with_columns
- collapse_joins
将连接和过滤器合并为更快的连接
- streaming
以流式方式运行查询的部分内容(此功能处于alpha状态)
警告
流模式被认为是不稳定的。它可能会在任何时候更改,而不被视为破坏性更改。
- tree_format
将输出格式化为树形结构。
自版本0.20.30起已弃用:请改用
format="tree"。
示例
>>> lf = pl.LazyFrame( ... { ... "a": ["a", "b", "a", "b", "b", "c"], ... "b": [1, 2, 3, 4, 5, 6], ... "c": [6, 5, 4, 3, 2, 1], ... } ... ) >>> lf.group_by("a", maintain_order=True).agg(pl.all().sum()).sort( ... "a" ... ).explain()