abou the cost estimation

Started by ljguo_1234over 23 years ago2 messageshackers
Jump to latest
#1ljguo_1234
ljguo_1234@sina.com

Hello, All
I have read the source code /cvsroot/pgsql/src/backend/optimizer/path/costsize.c and there is a function cost_sort(...). I think the code in 464 to 465 lines must be changed to:
startup_cost += npageaccesses *
(1.0 + cost_nonsequential_access(1)) * 0.5;

The original code is:
startup_cost += npageaccesses *
(1.0 + cost_nonsequential_access(npages)) * 0.5;
Can any one discuss about this issue with me ? Thanks for your response very much!
----------------------
Guo long jiang. 2002-9-6

______________________________________

===================================================================
������ѵ������� (http://mail.sina.com.cn)
���˷�����Ϣ�������г���һ�ߣ��ó���ʱ�ͳ��֣� (http://classad.sina.com.cn/2shou/)
�������ֻ�ͼƬ�����׶�������������ѡ��ÿ�춼�и��� (http://sms.sina.com.cn/cgi-bin/sms/smspic.cgi)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: ljguo_1234 (#1)
Re: abou the cost estimation

ljguo_1234 <ljguo_1234@sina.com> writes:

I have read the source code /cvsroot/pgsql/src/backend/optimizer/path/costsize.c and there is a function cost_sort(...). I think the code in 464 to 465 lines must be changed to:
startup_cost += npageaccesses *
(1.0 + cost_nonsequential_access(1)) * 0.5;

That would be wrong. Note the definition of cost_nonsequential_access:

* Estimate the cost of accessing one page at random from a relation
* (or sort temp file) of the given size in pages.

regards, tom lane