On Fri, 2003-09-05 at 09:18, Bruno Wolff III wrote:
> On Wed, Sep 03, 2003 at 23:19:24 -0700,
> Ringo <no@email.com> wrote:
> > What a prick..
>=20
> >From observing Tom's responses here, I think this is a real question (not
> an RTFM response). If the documentation doesn't make it clear to new read=
ers
> that explain analyze does execute the query (though doesn't return the
> results), then the documentation needs to get fixed.
I see 3 places on the EXPLAIN page that states ANALYZE queries are
executed. Perhaps it should be noted elsewhere, but it is well described
in the "SQL Commands" section of the docs.
One with the ANALYZE keyword under 'Inputs':
Flag to carry out the query and show actual run times.
One in the description:
The ANALYZE option causes the query to be actually executed, not
only planned. The total elapsed time expended within each plan
node (in milliseconds) and total number of rows it actually
returned are added to the display. This is useful for seeing
whether the planner's estimates are close to reality.
Finally, one in a big CAUTION block near the bottom of the description:
Keep in mind that the query is actually executed when ANALYZE is
used. Although EXPLAIN will discard any output that a SELECT
would return, other side-effects of the query will happen as
usual. If you wish to use EXPLAIN ANALYZE on an INSERT, UPDATE,
or DELETE query without letting the query affect your data, use
this approach:=20
=20=20=20=20=20=20=20=20
BEGIN;
EXPLAIN ANALYZE ...;
ROLLBACK;