Flashnux

GNU/Linux man pages

Livre :
Expressions régulières,
Syntaxe et mise en oeuvre :

ISBN : 978-2-7460-9712-4
EAN : 9782746097124
(Editions ENI)

GNU/Linux

RedHat 5.2

(Apollo)

explain(l)


EXPLAIN

EXPLAIN

NAME
SYNOPSIS
DESCRIPTION
EXAMPLES
SEE ALSO
BUGS

NAME

explain - explains statement execution details

SYNOPSIS

explain [verbose] query

DESCRIPTION

This command outputs details about the supplied query. The default output is the computed query cost. verbose displays the full query plan and cost.

EXAMPLES

In the examples, the table has a single column of float4. cost is the cost of scanning a base/join relation, size is the expected number of tuples from a scan, width is the length of a tuple.

tgl=> explain select a from test
NOTICE:QUERY PLAN:

Seq Scan on test (cost=0.00 size=0 width=4)

EXPLAIN
tgl=> explain verbose select sum(a) from test;
NOTICE:QUERY PLAN:

{AGG :cost 0 :size 0 :width 0 :state <> :qptargetlist
({TLE :resdom {RESDOM :resno 1 :restype 700 :restypmod 4 :resname "sum"
:reskey 0 :reskeyop 0 :resjunk 0}
:expr {AGGREG :aggname "sum" :basetype 700 :aggtype 700 :aggno 0
:target {VAR :varno 1 :varattno 1 :vartype 700 :varnoold 1 :varoattno 1}}})
:qpqual <> :lefttree {SEQSCAN :cost 0 :size 0 :width 4 :state <>
:qptargetlist ({TLE :resdom {RESDOM :resno 1 :restype 700 :restypmod 4
:resname "null" :reskey 0 :reskeyop 0 :resjunk 0}
:expr {VAR :varno 1 :varattno 1 :vartype 700 :varnoold 1 :varoattno 1}})
:qpqual <> :lefttree <> :righttree <> :scanrelid 1} :righttree <> :numagg 1 }

Aggregate (cost=0.00 size=0 width=0)
-> Seq Scan on test (cost=0.00 size=0 width=4)

The Postgres optimizer has chosen to use a sequential scan to retrieve rows from this table. Indices will used by the optimizer after tables grow large enough to warrant the access overhead; typically this might happen when tables have a few hundred rows.

SEE ALSO

delete(l), insert(l), select(l).

BUGS

The query cost and plan can be affected by running vacuum.



explain(l)