Possible mistake in 'Using EXPLAIN' section
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
"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
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
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
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
"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