MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / explain

Method explain

misc/python/materialize/optbench/sql.py:44–56  ·  view source on GitHub ↗

Prepends 'EXPLAIN ...' to the query respecting the given dialect.

(self, timing: bool, dialect: Dialect = Dialect.MZ)

Source from the content-addressed store, hash-verified

42 return m.group("name") if m else "anonoymous"
43
44 def explain(self, timing: bool, dialect: Dialect = Dialect.MZ) -> str:
45 """Prepends 'EXPLAIN ...' to the query respecting the given dialect."""
46
47 if dialect == Dialect.PG:
48 if timing:
49 return "\n".join(["EXPLAIN (ANALYZE, TIMING TRUE)", self.query])
50 else:
51 return "\n".join(["EXPLAIN", self.query])
52 else:
53 if timing:
54 return "\n".join(["EXPLAIN WITH(timing)", self.query])
55 else:
56 return "\n".join(["EXPLAIN", self.query])
57
58
59class ExplainOutput:

Callers 3

runMethod · 0.45
runFunction · 0.45
explainMethod · 0.45

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected