Re: Where can I find the code for extern OidFunctionCall7?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Where can I find the code for extern OidFunctionCall7?
Дата
Msg-id 20130905164614.GB6067@eldon.alvh.no-ip.org
обсуждение исходный текст
Ответ на Where can I find the code for extern OidFunctionCall7?  (arthernan <arthernan@hotmail.com>)
Список pgsql-hackers
arthernan wrote:
> OidFunctionCall7 is called from costsize.c, in function void cost_index. From
> the comments, I understand that there is an indirection mechanism here to
> allow for different index access methods. Looking at fmgr.h where it is
> declared is not clear to me where I would ultimately find the code.
> 
> Any pointers will be greatly appreciated

The code you're really looking for is the amcostestimate function of the
AM that the index uses.  So if it's a btree you want btcostestimate, for
instance.  You can see the AM definitions in the pg_am system catalog
and src/include/catalog/pg_am.h.

>     /*
>      * Call index-access-method-specific code to estimate the processing cost
>      * for scanning the index, as well as the selectivity of the index (ie,
>      * the fraction of main-table tuples we will have to retrieve) and its
>      * correlation to the main-table tuple order.
>      */
>     OidFunctionCall7(index->amcostestimate,
>                      PointerGetDatum(root),
>                      PointerGetDatum(path),
>                      Float8GetDatum(loop_count),
>                      PointerGetDatum(&indexStartupCost),
>                      PointerGetDatum(&indexTotalCost),
>                      PointerGetDatum(&indexSelectivity),
>                      PointerGetDatum(&indexCorrelation));


-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Where can I find the code for extern OidFunctionCall7?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: proposal: Set effective_cache_size to greater of .conf value, shared_buffers