1
1
.\" This is -*-nroff-*-
2
2
.\" XXX standard disclaimer belongs here....
3
- .\" $Header: /cvsroot/pgsql/src/man/Attic/explain.l,v 1.4 1997/01/16 14:56:59 momjian Exp $
4
- .TH EXPLAIN SQL 11/05/95 PostgreSQL PostgreSQL
3
+ .\" $Header: /cvsroot/pgsql/src/man/Attic/explain.l,v 1.5 1997/06/12 23:45:54 thomas Exp $
4
+ .TH EXPLAIN SQL 06/12/97 PostgreSQL PostgreSQL
5
5
.SH NAME
6
6
explain \(em explains statement execution details
7
7
.SH SYNOPSIS
@@ -12,6 +12,50 @@ explain \(em explains statement execution details
12
12
This command outputs details about the supplied query. The default
13
13
output is the computed query cost. \f2 verbose \f1 displays the full query
14
14
plan and cost.
15
+
16
+ .SH EXAMPLES
17
+ In the examples, the table has a single column of float4.
18
+ \fB cost \fR is the cost of scanning a base/join relation,
19
+ \fB size \fR is the expected number of tuples from a scan,
20
+ \fB width \fR is the length of a tuple.
21
+
22
+ .nf
23
+ tgl=> explain select a from test\g
24
+ NOTICE:QUERY PLAN:
25
+
26
+ Seq Scan on test (cost=0.00 size=0 width=4)
27
+
28
+ EXPLAIN
29
+ tgl=> explain verbose select sum(a) from test;
30
+ NOTICE:QUERY PLAN:
31
+
32
+ {AGG :cost 0 :size 0 :width 0 :state nil :qptargetlist
33
+ ({TLE :resdom {RESDOM :resno 1 :restype 700 :reslen 4 :resname "sum"
34
+ :reskey 0 :reskeyop 0 :resjunk 0}
35
+ :expr {AGGREG :aggname "sum" :basetype 700 :aggtype 700 :aggno 0
36
+ :target {VAR :varno 1 :varattno 1 :vartype 700 :varnoold 1 :varoattno 1}}})
37
+ :qpqual nil :lefttree {SEQSCAN :cost 0 :size 0 :width 4 :state nil
38
+ :qptargetlist ({TLE :resdom {RESDOM :resno 1 :restype 700 :reslen 4
39
+ :resname "null" :reskey 0 :reskeyop 0 :resjunk 0}
40
+ :expr {VAR :varno 1 :varattno 1 :vartype 700 :varnoold 1 :varoattno 1}})
41
+ :qpqual nil :lefttree nil :righttree nil :scanrelid 1} :righttree nil :numagg 1 }
42
+
43
+ Aggregate (cost=0.00 size=0 width=0)
44
+ -> Seq Scan on test (cost=0.00 size=0 width=4)
45
+ .fi
46
+
47
+ The Postgres optimizer has chosen to use a sequential scan to retrieve rows from
48
+ this table. Indices will used by the optimizer
49
+ after tables grow large enough to warrant the access
50
+ overhead; typically this might happen when tables have a few hundred rows.
51
+
52
+ .SH "SEE ALSO"
53
+ delete(l),
54
+ insert(l),
55
+ select(l).
56
+
57
+ .SH BUGS
58
+
15
59
.PP
16
60
The query cost and plan can be affected by running vacuum.
17
61
0 commit comments