From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: JEANARTHUR@EUROVOX.FR
Cc: pgsql-admin@postgresql.org
Subject: Re: Explain
Date: Mon, 7 Jul 2003 08:46:49 -0700 (PDT)
Message-ID: <20030707084355.E76534-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <3F0998C1.11276.1652504@localhost>
On Mon, 7 Jul 2003 JEANARTHUR@EUROVOX.FR wrote:
> Hi,
>
> when I do an explain on a certain query, I have this answer :
>
>
> QUERY PLAN
> --------------------------------------------------------------------------------------
> Aggregate (cost=100017927.48..100017927.48 rows=1 width=8)
> -> Seq Scan on stats_daily_2003
> (cost=100000000.00..100017927.47 rows=1 width=8)
> Filter: ((id_compte = 29075) AND (periode = '07-07-2003'::date))
> (3 rows)
>
>
> Well, I don"t really undestand the meaning of
>
> cost=100000000.00..100017927.47
>
> and
>
> cost=100017927.48..100017927.48
>
> I guess this result is relatively bad.
This probably actually implies that you've done something like set
enable_seqscan=off at some point which makes the costs of seqscans very high
to discourage them. In any case, this plan is still expected to be much
more expensive than the below even when not taking that into account. You
may also want to do explain analyze to get real world numbers rather than
just the estimates.
> The same query on a similar table but with an index give :
> QUERY PLAN
> --------------------------------------------------------------------------------------------
> ----------------
> Aggregate (cost=9.60..9.60 rows=1 width=8)
> -> Index Scan using ap_stats_daily_2003_save on
> stats_daily_2003_save (cost=0.00..9.59 rows=2 width=8)
> Index Cond: ((periode = '07-07-2003'::date) AND (id_compte =
> 29075))
> (3 rows)
>
> Could you confirm me the second explain is "better" than the first one
> ?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: sszabo@megazone23.bigpanda.com, JEANARTHUR@EUROVOX.FR
Subject: Re: Explain
In-Reply-To: <20030707084355.E76534-100000@megazone23.bigpanda.com>
References: <3F0998C1.11276.1652504@localhost> <20030707084355.E76534-100000@megazone23.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox