SPI access to PostgreSQL query plan - Mailing list pgsql-hackers

From Cristiano Duarte
Subject SPI access to PostgreSQL query plan
Date
Msg-id 36bc054c0709170654g575d7fb9tbc2f53b1e4c2384@mail.gmail.com
Whole thread Raw
Responses Re: SPI access to PostgreSQL query plan
List pgsql-hackers
Hi,<br /><br />Is there a way to have access to PostgreSQL query plan and/or predicates inside a function using spi (or
anyother way)?<br />For example:<br /><br />explain select * from my_func() as (code int, name varchar) where name like
'a%';<br />                          QUERY PLAN<br />--------------------------------------------------------------<br
/> FunctionScan on my_func  (cost=0.00..15.00 rows=5 width=36)<br />   Filter: ((name)::text ~~ 'a%'::text) <br /><br
/>Iwould like to know, inside the my_func function that PostgreSQL will filter the function's returned result on the
namecolumn <br />with a like operator matching 'a%'. Since inside the my_func function I do another database query, I
could"pre-filter" this <br />query and reduce the amount of records returned.<br /><br />If the whole plan cannot be
exposedto spi, can only the part involved on filtering/manipulating the records returned from<br /> the function
call?<br/><br />Is the query plan saved in memory at a place where a spi function can have access? <br /><br
/>Regards,<br/><br />Cristiano Duarte.<br /><br /> 

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Fix up text concatenation so that it accepts all the reasonable
Next
From: Tom Lane
Date:
Subject: Re: SPI access to PostgreSQL query plan