Skip to content

Document EXPLAIN (OPT, ENV) URL output #5776

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

Merged
merged 1 commit into from
Nov 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions v19.2/explain.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,28 @@ To include cost and type details, use `OPT, TYPES`:

<a name="opt-env-option"></a>

To include all details used by the optimizer, including statistics, use `OPT, ENV`:
To include all details used by the optimizer, including statistics, use `OPT, ENV`.

{% include copy-clipboard.html %}
~~~ sql
> EXPLAIN (OPT, ENV) SELECT * FROM episodes WHERE season > 3 ORDER BY season ASC;
~~~

~~~
Version: CockroachDB CCL v19.2.0
text
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
https://cockroachdb.github.io/text/decode.html#eJzEVcFum0wQPmefYsQl9v8DYQl1bCJVImTT0mIcwTatFUWIwLZZBbMWLE2jqlIewsc-nZ-kwjGUXNIeGpkDEt_HNzP7DTNcsLLiorDBFeltKZL05vQEXNeHr3iim7qhlamOYfBtPIpHlpYslznTsqS84wW2VLiueS7BNPDkABsH2AI8ts2xbVoqfBFYx6b-aoiQGxKHEqDOiU-ALXklMlbBAO3xDLyAjiGYUQg--L6K9iqWVKLYwo9QUS-ePEsucwYRDb3gTSeTSZklksEpcb2p47e4OwsiGjpeQEFZlnyRlPcKnIfe1Ann8J7MYcAzcCJ3qKK9M2fq-fPeewOeqfBYkApFvVBhk1qFNtsQDY8RcnxKwu3pGkaW7FZf1tc5T_XutF7wjrgUIupQL6KeG8H-JQIA-L65N5eSirxeFJViw2UHbgieKR1wpfYEJUsky-JEKjYoTRs0jDXDAoxt07TNkW5aE-PI_N8wbMNQesqMV5IXqYxTUReN-mjSY294JUWcijyW90vWxG787-uLZLHB4zippYjjJ1yd511co0eU4q6Xb4P_UP_ahMdGvLgRh8_6sGMPinrx4gaYz38JO3ZgM4G7noZdT8J2_by8DaN_b4P1BxvQ1f4xQuTTue94AQxm51QFElwMISJ-s0H_g7NwNv39G_n4loRku6XhNRzCLDwlIZzMW8yJ3GOkaZqGKlFKBOvVar16WK8eoGI5S-W2nPXqZwunSdHF79hW9JnnkpVVvyP9iG0Z6FcAAAD__yq9370=
(1 row)
~~~

<span class="version-tag">New in v19.1:</span> The output of `EXPLAIN (OPT,ENV)` is now a URL with the data encoded in the fragment portion. Opening the URL shows a page with the decoded data. This change makes it easier to share debugging information across different systems without encountering formatting issues.

Note that the data is processed in the local browser session and is never sent out over the network. Keep in mind that if you are using any browser extensions, they may be able to access the data locally.

When you visit the URL above you should see the following output in your browser.

~~~
Version: CockroachDB CCL v19.2.0-rc.1 (x86_64-apple-darwin14, built 2019/10/14 18:28:24, go1.12.5)

CREATE TABLE episodes (
id INT8 NOT NULL,
Expand All @@ -304,7 +317,7 @@ ALTER TABLE startrek.public.episodes INJECT STATISTICS '[
"columns": [
"id"
],
"created_at": "2019-10-08 18:29:26.222957+00:00",
"created_at": "2019-11-04 11:22:26.249072+00:00",
"distinct_count": 79,
"histo_col_type": "INT8",
"name": "__auto__",
Expand All @@ -315,7 +328,7 @@ ALTER TABLE startrek.public.episodes INJECT STATISTICS '[
"columns": [
"season"
],
"created_at": "2019-10-08 18:29:26.222957+00:00",
"created_at": "2019-11-04 11:22:26.249072+00:00",
"distinct_count": 3,
"histo_col_type": "",
"name": "__auto__",
Expand All @@ -326,7 +339,7 @@ ALTER TABLE startrek.public.episodes INJECT STATISTICS '[
"columns": [
"num"
],
"created_at": "2019-10-08 18:29:26.222957+00:00",
"created_at": "2019-11-04 11:22:26.249072+00:00",
"distinct_count": 29,
"histo_col_type": "",
"name": "__auto__",
Expand All @@ -337,7 +350,7 @@ ALTER TABLE startrek.public.episodes INJECT STATISTICS '[
"columns": [
"title"
],
"created_at": "2019-10-08 18:29:26.222957+00:00",
"created_at": "2019-11-04 11:22:26.249072+00:00",
"distinct_count": 79,
"histo_col_type": "",
"name": "__auto__",
Expand All @@ -348,7 +361,7 @@ ALTER TABLE startrek.public.episodes INJECT STATISTICS '[
"columns": [
"stardate"
],
"created_at": "2019-10-08 18:29:26.222957+00:00",
"created_at": "2019-11-04 11:22:26.249072+00:00",
"distinct_count": 76,
"histo_col_type": "",
"name": "__auto__",
Expand Down