pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedPossible mistake in 'Using EXPLAIN' section
6+ messages / 3 participants
[nested] [flat]
* Possible mistake in 'Using EXPLAIN' section
@ 2007-10-10 11:06 James Shaw <js102@zepler.net>
2007-10-10 12:10 ` Re: Possible mistake in 'Using EXPLAIN' section Tom Lane <tgl@sss.pgh.pa.us>
2007-10-10 12:13 ` Re: Possible mistake in 'Using EXPLAIN' section Guillaume Lelarge <guillaume@lelarge.info>
0 siblings, 2 replies; 6+ messages in thread
From: James Shaw @ 2007-10-10 11:06 UTC (permalink / raw)
To: pgsql-docs
The example given has "Seq Scan on tenk1 (cost=0.00..458.00" in the example,
but then says, "you will find out that tenk1 has 358 disk pages" and "the
cost is estimated at 358 page reads". Shouldn't this be 458 disk page
reads?
I couldn't see this already discussed on this list. Is there a URL that has
the latest docs compiled from CVS?
Thanks
James Shaw
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Possible mistake in 'Using EXPLAIN' section
2007-10-10 11:06 Possible mistake in 'Using EXPLAIN' section James Shaw <js102@zepler.net>
@ 2007-10-10 12:10 ` Tom Lane <tgl@sss.pgh.pa.us>
2007-10-10 12:51 ` Re: Possible mistake in 'Using EXPLAIN' section James Shaw <js102@zepler.net>
1 sibling, 1 reply; 6+ messages in thread
From: Tom Lane @ 2007-10-10 12:10 UTC (permalink / raw)
To: James Shaw <js102@zepler.net>; +Cc: pgsql-docs
"James Shaw" <js102@zepler.net> writes:
> The example given has "Seq Scan on tenk1 (cost=0.00..458.00" in the example,
> but then says, "you will find out that tenk1 has 358 disk pages" and "the
> cost is estimated at 358 page reads". Shouldn't this be 458 disk page
> reads?
No. Why did you stop reading in mid-sentence?
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Possible mistake in 'Using EXPLAIN' section
2007-10-10 11:06 Possible mistake in 'Using EXPLAIN' section James Shaw <js102@zepler.net>
2007-10-10 12:10 ` Re: Possible mistake in 'Using EXPLAIN' section Tom Lane <tgl@sss.pgh.pa.us>
@ 2007-10-10 12:51 ` James Shaw <js102@zepler.net>
2007-10-22 12:14 ` Re: Possible mistake in 'Using EXPLAIN' section James Shaw <js102@zepler.net>
0 siblings, 1 reply; 6+ messages in thread
From: James Shaw @ 2007-10-10 12:51 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-docs
On 10/10/2007, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "James Shaw" <js102@zepler.net> writes:
> > The example given has "Seq Scan on tenk1 (cost=0.00..458.00" in the example,
> > but then says, "you will find out that tenk1 has 358 disk pages" and "the
> > cost is estimated at 358 page reads". Shouldn't this be 458 disk page
> > reads?
>
> No. Why did you stop reading in mid-sentence?
I'm sorry, I misunderstood. I've reread, and understand where the
extra 100 comes from now. Perhaps this could be reworded:
This is about as straightforward as it gets. If you do
SELECT relpages, reltuples FROM pg_class WHERE relname = 'tenk1';
you will find out that tenk1 has 358 disk pages and 10000 rows. The
estimated cost is (disk pages read * seq_page_cost) + (number of rows
read * cpu_tuple_cost). By default, seq_page_cost is 1.0 and
cpu_tuple_cost is 0.01. Therefore, the estimated cost is (358 * 1.0)
+ (10000 * 0.01) = 458.
Thanks
James
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Possible mistake in 'Using EXPLAIN' section
2007-10-10 11:06 Possible mistake in 'Using EXPLAIN' section James Shaw <js102@zepler.net>
2007-10-10 12:10 ` Re: Possible mistake in 'Using EXPLAIN' section Tom Lane <tgl@sss.pgh.pa.us>
2007-10-10 12:51 ` Re: Possible mistake in 'Using EXPLAIN' section James Shaw <js102@zepler.net>
@ 2007-10-22 12:14 ` James Shaw <js102@zepler.net>
2007-10-22 21:35 ` Re: Possible mistake in 'Using EXPLAIN' section Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 6+ messages in thread
From: James Shaw @ 2007-10-22 12:14 UTC (permalink / raw)
To: pgsql-docs
On 10/10/2007, James Shaw <js102@zepler.net> wrote:
>
> On 10/10/2007, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > "James Shaw" <js102@zepler.net> writes:
> > > The example given has "Seq Scan on tenk1 (cost=0.00..458.00" in the
> example,
> > > but then says, "you will find out that tenk1 has 358 disk pages" and
> "the
> > > cost is estimated at 358 page reads". Shouldn't this be 458 disk page
> > > reads?
> >
> > No. Why did you stop reading in mid-sentence?
>
> I'm sorry, I misunderstood. I've reread, and understand where the
> extra 100 comes from now. Perhaps this could be reworded:
>
> This is about as straightforward as it gets. If you do
> SELECT relpages, reltuples FROM pg_class WHERE relname = 'tenk1';
>
> you will find out that tenk1 has 358 disk pages and 10000 rows. The
> estimated cost is (disk pages read * seq_page_cost) + (number of rows
> read * cpu_tuple_cost). By default, seq_page_cost is 1.0 and
> cpu_tuple_cost is 0.01. Therefore, the estimated cost is (358 * 1.0)
> + (10000 * 0.01) = 458.
Were there any thoughts on this? I was hoping this might be included in the
manual, since I felt it was somewhat clearer.
James
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Possible mistake in 'Using EXPLAIN' section
2007-10-10 11:06 Possible mistake in 'Using EXPLAIN' section James Shaw <js102@zepler.net>
2007-10-10 12:10 ` Re: Possible mistake in 'Using EXPLAIN' section Tom Lane <tgl@sss.pgh.pa.us>
2007-10-10 12:51 ` Re: Possible mistake in 'Using EXPLAIN' section James Shaw <js102@zepler.net>
2007-10-22 12:14 ` Re: Possible mistake in 'Using EXPLAIN' section James Shaw <js102@zepler.net>
@ 2007-10-22 21:35 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 6+ messages in thread
From: Tom Lane @ 2007-10-22 21:35 UTC (permalink / raw)
To: James Shaw <js102@zepler.net>; +Cc: pgsql-docs
"James Shaw" <js102@zepler.net> writes:
>> I'm sorry, I misunderstood. I've reread, and understand where the
>> extra 100 comes from now. Perhaps this could be reworded:
>> ...
> Were there any thoughts on this? I was hoping this might be included in the
> manual, since I felt it was somewhat clearer.
Done, sorry for not getting to it sooner.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Possible mistake in 'Using EXPLAIN' section
2007-10-10 11:06 Possible mistake in 'Using EXPLAIN' section James Shaw <js102@zepler.net>
@ 2007-10-10 12:13 ` Guillaume Lelarge <guillaume@lelarge.info>
1 sibling, 0 replies; 6+ messages in thread
From: Guillaume Lelarge @ 2007-10-10 12:13 UTC (permalink / raw)
To: James Shaw <js102@zepler.net>; +Cc: pgsql-docs
James Shaw a écrit :
> The example given has "Seq Scan on tenk1 (cost=0.00..458.00" in the
> example, but then says, "you will find out that |tenk1| has 358 disk
> pages" and "the cost is estimated at 358 page reads". Shouldn't this be
> 458 disk page reads?
>
> I couldn't see this already discussed on this list. Is there a URL that
> has the latest docs compiled from CVS?
>
http://momjian.us/main/writings/pgsql/sgml/
(built every five minutes)
Regards.
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2007-10-22 21:35 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-10-10 11:06 Possible mistake in 'Using EXPLAIN' section James Shaw <js102@zepler.net>
2007-10-10 12:10 ` Tom Lane <tgl@sss.pgh.pa.us>
2007-10-10 12:51 ` James Shaw <js102@zepler.net>
2007-10-22 12:14 ` James Shaw <js102@zepler.net>
2007-10-22 21:35 ` Tom Lane <tgl@sss.pgh.pa.us>
2007-10-10 12:13 ` Guillaume Lelarge <guillaume@lelarge.info>
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