verticapy.vDataFrame.explain#
- vDataFrame.explain(digraph: bool = False) str #
Provides information on how Vertica is computing the current
vDataFrame
relation.Parameters#
- digraph: bool, optional
If set to True, returns only the digraph of the explain plan.
Returns#
- str
explain plan
Examples#
Let’s begin by importing VerticaPy.
import verticapy as vp
Hint
By assigning an alias to
verticapy
, we mitigate the risk of code collisions with other libraries. This precaution is necessary because verticapy uses commonly known function names like “average” and “median”, which can potentially lead to naming conflicts. The use of an alias ensures that the functions fromverticapy
are used as intended without interfering with functions from other libraries.Let us create a dummy dataset and check its Query Plan:
vdf = vp.vDataFrame({"val": [0, 10, 20]})
123valInteger100%1 0 2 10 3 20 We can display the Query Plan of the
vDataFrame
using:print(vdf.explain()) ------------------------------ QUERY PLAN DESCRIPTION: EXPLAIN SELECT /*+LABEL('vDataframe.explain')*/ * FROM ((SELECT 0 AS "val") UNION ALL (SELECT 10 AS "val") UNION ALL (SELECT 20 AS "val")) VERTICAPY_SUBTABLE Access Path: +-UNION ALL [Cost: 30, Rows: 3] (PATH ID: 8) | +---> STORAGE ACCESS for dual [Cost: 10, Rows: 1] (PATH ID: 10) | | Projection: v_catalog.dual_p | +---> STORAGE ACCESS for dual [Cost: 10, Rows: 1] (PATH ID: 12) | | Projection: v_catalog.dual_p | +---> STORAGE ACCESS for dual [Cost: 10, Rows: 1] (PATH ID: 14) | | Projection: v_catalog.dual_p ----------------------------------------------- PLAN: BASE QUERY PLAN (GraphViz Format) ----------------------------------------------- digraph G { graph [rankdir=BT, label = "BASE QUERY PLAN Query: EXPLAIN SELECT /*+LABEL(\'vDataframe.explain\')*/ * FROM ((SELECT 0 AS \"val\") UNION ALL (SELECT 10 AS \"val\") UNION ALL (SELECT 20 AS \"val\")) VERTICAPY_SUBTABLE All Nodes Vector: node[0]=v_demo_node0001 (initiator) Up ", labelloc=t, labeljust=l ordering=out] 0[label = "Root OutBlk=[UncTuple]", color = "green", shape = "house"]; 1[label = "NewEENode OutBlk=[UncTuple]", color = "green", shape = "box"]; 2[label = "UnionAll Unc: Integer(8)", color = "green", shape = "box"]; 3[label = "StorageUnionStep: dual_p RLE: Integer(8)", color = "purple", shape = "box"]; 4[label = "ExprEval: 0 RLE: Integer(8)", color = "brown", shape = "box"]; 5[label = "ScanStep: dual_p epoch (not emitted)", color = "brown", shape = "box"]; 6[label = "StorageUnionStep: dual_p RLE: Integer(8)", color = "purple", shape = "box"]; 7[label = "ExprEval: 10 RLE: Integer(8)", color = "brown", shape = "box"]; 8[label = "ScanStep: dual_p epoch (not emitted)", color = "brown", shape = "box"]; 9[label = "StorageUnionStep: dual_p RLE: Integer(8)", color = "purple", shape = "box"]; 10[label = "ExprEval: 20 RLE: Integer(8)", color = "brown", shape = "box"]; 11[label = "ScanStep: dual_p epoch (not emitted)", color = "brown", shape = "box"]; 1->0 [label = "V[0]", color = "black"]; 2->1 [label = "0", color = "blue"]; 3->2 [label = "0", color = "blue"]; 4->3 [label = "0", color = "blue"]; 5->4 [label = "0", color = "blue"]; 6->2 [label = "1", color = "blue"]; 7->6 [label = "0", color = "blue"]; 8->7 [label = "0", color = "blue"]; 9->2 [label = "2", color = "blue"]; 10->9 [label = "0", color = "blue"]; 11->10 [label = "0", color = "blue"];}
See also
vDataFrame.
info()
: Displays information about the different vDataFrame transformations