From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: PostgreSQL and explain |
Date: | 2002-04-01 17:33:15 |
Message-ID: | 5414.1017682395@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com> writes:
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
Would it be possible to turn off the MIME-ification of your email?
> I mean: the difference for cost = 0.00..30.00 and cost = 0.00..7370.80 ...
> (forgive my newbie-ness) but this looks like an increase ... why is that?
The cost=30 number is completely bogus since it is based on no
statistical data whatever; until you've done a VACUUM or ANALYZE,
the planner is flying blind and has to work with some default
assumptions about table size. (Which are 10 pages and 1000 tuples,
IIRC.)
After VACUUM the numbers are at least somewhat meaningful, but you
have to remember that (a) they're on an arbitrary scale of 1 disk
page fetch = 1 cost unit, and (b) the planner's opinion is frequently
very far from reality. I'd never trust EXPLAIN's output as a guide
to what's really cheap or not; use real timings. (EXPLAIN ANALYZE
can be helpful, since it accumulates real timings.)
There's more info about EXPLAIN in the "performance tips" chapter of the
User's Guide.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Atkins | 2002-04-01 18:13:02 | substring indices / array operators |
Previous Message | Stephan Szabo | 2002-04-01 16:42:14 | Re: NOT IN queries |