pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
To: digoal@126.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #9552: IndexOnlyScan startup_cost>0, why not equal 0?it's a bug?
Date: Thu, 13 Mar 2014 14:34:26 +0900 (Tokyo Standard Time)
Message-ID: <20140313.143426.16396458.horiguchi.kyotaro@lab.ntt.co.jp> (raw)
In-Reply-To: <20140313005429.398.2021@wrigleys.postgresql.org>
References: <20140313005429.398.2021@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hello,

> I belive index only scan can return tuple direct, it's not need to scan
> heappage, why it's startup_cost equal to index scan?
> I'ts a bug?

No. It is a result of reasonable calculus.

>  Index Scan using t11_pkey on t11  (cost=0.29..4.31 rows=1 width=9)

Index scan runs through several disk (but usually on cache)
blocks during descending down to the leaf node in the index tree
and does comparisons for certain amount of index entries(tuples)
in each index node with regard to btree. The figure made from the
expected number of the comparisons multiplied by
cpu_operator_cost. Each access methods (index types) has their
own function to do that.

=# select amname, amcostestimate from pg_am where amname = 'btree';
 amname | amcostestimate 
--------+----------------
 btree  | btcostestimate

The function 'btcostestimate' in selfuncs.c calculates it for
btree index. You can see the details there if you wish.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (4+ messages)  latest in thread

Message-ID: <20140313.143426.16396458.horiguchi.kyotaro@lab.ntt.co.jp>
Permalink:  ../20140313.143426.16396458.horiguchi.kyotaro@lab.ntt.co.jp/
Also on:    postgresql.org/message-id/20140313.143426.16396458.horiguchi.kyotaro@lab.ntt.co.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: horiguchi.kyotaro@lab.ntt.co.jp, digoal@126.com
  Subject: Re: BUG #9552: IndexOnlyScan startup_cost>0, why not equal 0?it's a bug?
  In-Reply-To: <20140313.143426.16396458.horiguchi.kyotaro@lab.ntt.co.jp>
  References: <20140313005429.398.2021@wrigleys.postgresql.org> <20140313.143426.16396458.horiguchi.kyotaro@lab.ntt.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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