SPI access to PostgreSQL query plan

Поиск
Список
Период
Сортировка
Искать
От
Cristiano Duarte
Тема
SPI access to PostgreSQL query plan
Дата
Msg-id
36bc054c0709170654g575d7fb9tbc2f53b1e4c2384@mail.gmail.com
Список
Дерево обсуждения
SPI access to PostgreSQL query plan "Cristiano Duarte" <cunha17@gmail.com>
Re: SPI access to PostgreSQL query plan Tom Lane <tgl@sss.pgh.pa.us>
Re: SPI access to PostgreSQL query plan "Cristiano Duarte" <cunha17@gmail.com>
Re: SPI access to PostgreSQL query plan "Florian G. Pflug" <fgp@phlo.org>
Re: SPI access to PostgreSQL query plan Michael Glaesemann <grzm@seespotcode.net>
Re: SPI access to PostgreSQL query plan Tom Lane <tgl@sss.pgh.pa.us>
Hi,

Is there a way to have access to PostgreSQL query plan and/or predicates inside a function using spi (or any other way)?
For example:

explain select * from my_func() as (code int, name varchar) where name like 'a%';
                          QUERY PLAN
--------------------------------------------------------------
 Function Scan on my_func  (cost=0.00..15.00 rows=5 width=36)
   Filter: ((name)::text ~~ 'a%'::text)

I would like to know, inside the my_func function that PostgreSQL will filter the function's returned result on the name column
with a like operator matching 'a%'. Since inside the my_func function I do another database query, I could "pre-filter" this
query and reduce the amount of records returned.

If the whole plan cannot be exposed to spi, can only the part involved on filtering/manipulating the records returned from
 the function call?

Is the query plan saved in memory at a place where a spi function can have access?

Regards,

Cristiano Duarte.

В списке pgsql-hackers по дате отправления
От: Tom Lane
Дата:
От: Tom Lane
Дата:
FAQ