Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
83527b13
Commit
83527b13
authored
14 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Add EXPLAIN documentation example.
gabrielle <gorthx@gmail.com>
parent
72405b06
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/src/sgml/ref/explain.sgml
+46
-1
46 additions, 1 deletion
doc/src/sgml/ref/explain.sgml
with
46 additions
and
1 deletion
doc/src/sgml/ref/explain.sgml
+
46
−
1
View file @
83527b13
<!--
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/explain.sgml,v 1.5
0
2010/0
4
/03
0
7:
23:01 petere
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/explain.sgml,v 1.5
1
2010/0
8
/03
1
7:
14:19 momjian
Exp $
PostgreSQL documentation
PostgreSQL documentation
-->
-->
...
@@ -247,6 +247,29 @@ EXPLAIN SELECT * FROM foo;
...
@@ -247,6 +247,29 @@ EXPLAIN SELECT * FROM foo;
</programlisting>
</programlisting>
</para>
</para>
<para>
Here is the same query, with JSON formatting:
<programlisting>
EXPLAIN (FORMAT JSON) SELECT * FROM foo;
QUERY PLAN
--------------------------------
[ +
{ +
"Plan": { +
"Node Type": "Seq Scan",+
"Relation Name": "foo", +
"Alias": "foo", +
"Startup Cost": 0.00, +
"Total Cost": 155.00, +
"Plan Rows": 10000, +
"Plan Width": 4 +
} +
} +
]
(1 row)
</programlisting>
</para>
<para>
<para>
If there is an index and we use a query with an indexable
If there is an index and we use a query with an indexable
<literal>WHERE</literal> condition, <command>EXPLAIN</command>
<literal>WHERE</literal> condition, <command>EXPLAIN</command>
...
@@ -263,6 +286,28 @@ EXPLAIN SELECT * FROM foo WHERE i = 4;
...
@@ -263,6 +286,28 @@ EXPLAIN SELECT * FROM foo WHERE i = 4;
</programlisting>
</programlisting>
</para>
</para>
<para>
Here is the same query, but in YAML output:
<programlisting>
EXPLAIN (FORMAT YAML) SELECT * FROM foo WHERE i='4';
QUERY PLAN
-------------------------------
- Plan: +
Node Type: "Index Scan" +
Scan Direction: "Forward"+
Index Name: "fi" +
Relation Name: "foo" +
Alias: "foo" +
Startup Cost: 0.00 +
Total Cost: 5.98 +
Plan Rows: 1 +
Plan Width: 4 +
Index Cond: "(i = 4)"
(1 row)
</programlisting>
XML output is left as an exercise to the reader.
</para>
<para>
<para>
Here is the same plan with costs suppressed:
Here is the same plan with costs suppressed:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment