From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Question about cost-calculation |
Date: | 2008-06-02 10:05:29 |
Message-ID: | 20080602100529.GD25294@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
according the doc
(http://www.postgresql.org/docs/8.3/interactive/runtime-config-query.html#GUC-CPU-OPERATOR-COST)
Quote:
Sets the planner's estimate of the cost of processing each operator or function executed during a query.
i expected for a 1000 row test-table a cost per function of 2.5
(cpu_operator_cost = 0.0025), but i got 5.
First, a full table scan:
test=*# explain analyse select i from s_test;
QUERY PLAN
-------------------------------------------------------------------------------------------------------
Seq Scan on s_test (cost=0.00..15.00 rows=1000 width=4) (actual time=0.013..2.315 rows=1000 loops=1)
Total runtime: 4.232 ms
(2 rows)
cost=15.
Now, the same query but with one or two functions on a particular column:
test=*# explain analyse select i, cos(i) from s_test;
QUERY PLAN
-------------------------------------------------------------------------------------------------------
Seq Scan on s_test (cost=0.00..20.00 rows=1000 width=4) (actual time=0.026..3.043 rows=1000 loops=1)
Total runtime: 5.017 ms
(2 rows)
test=*# explain analyse select i, cos(i), md5(i) from s_test;
QUERY PLAN
-------------------------------------------------------------------------------------------------------
Seq Scan on s_test (cost=0.00..25.00 rows=1000 width=4) (actual time=0.040..5.414 rows=1000 loops=1)
Total runtime: 7.444 ms
(2 rows)
cost increased by 5 per function-call, why, why not 2.5?
Version: 8.1
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
From | Date | Subject | |
---|---|---|---|
Next Message | Brian A. Seklecki | 2008-06-02 12:12:11 | Re: [Xen-users] SNMP AgentX subagent for Xen |
Previous Message | Andrej Ricnik-Bay | 2008-06-02 09:45:03 | Re: Bottom Posting |