New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plan: support DOT explain format #4562

Merged
merged 7 commits into from Sep 19, 2017

Conversation

Projects
None yet
4 participants
@zz-jason
Member

zz-jason commented Sep 19, 2017

usage example:

create table t(a bigint, b bigint);
desc format = "dot" select A.a, B.b from t A join t B on A.a > B.b where A.a < 10;

which returns:

TiDB > desc format = "dot" select A.a, B.b from t A join t B on A.a > B.b where A.a < 10;desc format = "dot" select A.a, B.b from t A join t B on A.a > B.b where A.a < 10;
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| dot contents                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
digraph HashRightJoin_7 {
subgraph cluster7{
node [style=filled, color=lightgrey]
color=black
label = "root"
"HashRightJoin_7" -> "TableReader_10"
"HashRightJoin_7" -> "TableReader_12"
}
subgraph cluster9{
node [style=filled, color=lightgrey]
color=black
label = "cop"
"Selection_9" -> "TableScan_8"
}
subgraph cluster11{
node [style=filled, color=lightgrey]
color=black
label = "cop"
"TableScan_11"
}
"TableReader_10" -> "Selection_9"
"TableReader_12" -> "TableScan_11"
}
 |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

copy and paste the dot file content to http://www.webgraphviz.com/, that will generate a graph:

2017-09-19 13 23 37

if you have dot installed on your computer, you can do that by:

dot xx.dot -T png -O

zz-jason added some commits Sep 19, 2017

@coocood

This comment has been minimized.

Show comment
Hide comment
@coocood

coocood Sep 19, 2017

Member

Nice format!

Member

coocood commented Sep 19, 2017

Nice format!

Show outdated Hide outdated plan/plans.go
@shenli

This comment has been minimized.

Show comment
Hide comment
@shenli

shenli Sep 19, 2017

Member

"explain format = "dot" select xxx " has the same result with "desc format = "dot" select xxx "?

Member

shenli commented Sep 19, 2017

"explain format = "dot" select xxx " has the same result with "desc format = "dot" select xxx "?

@zz-jason

This comment has been minimized.

Show comment
Hide comment
@zz-jason

zz-jason Sep 19, 2017

Member

yes, explain, desc, describe are synonyms

Member

zz-jason commented Sep 19, 2017

yes, explain, desc, describe are synonyms

@coocood

This comment has been minimized.

Show comment
Hide comment
@coocood

coocood Sep 19, 2017

Member

LGTM

Member

coocood commented Sep 19, 2017

LGTM

@XuHuaiyu

This comment has been minimized.

Show comment
Hide comment
@XuHuaiyu

XuHuaiyu Sep 19, 2017

Contributor

easy to add test case?

Contributor

XuHuaiyu commented Sep 19, 2017

easy to add test case?

@XuHuaiyu

LGTM

@coocood coocood merged commit 9e6accb into master Sep 19, 2017

3 of 4 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
ci/circleci Your tests passed on CircleCI!
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@coocood coocood deleted the zz-jason/explain/dot branch Sep 19, 2017

@zz-jason

This comment has been minimized.

Show comment
Hide comment
@zz-jason
Member

zz-jason commented Sep 19, 2017

to #4279

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment