Обсуждение: A question about ExplainOnePlan()

Поиск
Список
Период
Сортировка

A question about ExplainOnePlan()

От
"Gurjeet Singh"
Дата:
<span style="font-family: courier new,monospace;">Hi All,</span><br style="font-family: courier new,monospace;" /><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">    In ExplainOnePlan(),
weare calling ExecutorStart() and ExecutorEnd() even if we are not doing EXPLAIN ANALYZE. Whereas, ExecutorRun() is
calledonly if we are ANALYZEing. </span><br style="font-family: courier new,monospace;" /><br style="font-family:
couriernew,monospace;" /><span style="font-family: courier new,monospace;">    Can we avoid calls to
Executor{Start|End}()here, or is it necessary to call them even for non-ANALYZE case? </span><br style="font-family:
couriernew,monospace;" /><br style="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">Regards,</span><brclear="all" style="font-family: courier new,monospace;" /><br style="font-family:
couriernew,monospace;" /><span style="font-family: courier new,monospace;">-- </span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">gurjeet[.singh]@ EnterpriseDB.com</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">singh.gurjeet@{ gmail |
hotmail| yahoo }.com </span> 

Re: A question about ExplainOnePlan()

От
Tom Lane
Дата:
"Gurjeet Singh" <singh.gurjeet@gmail.com> writes:
>     In ExplainOnePlan(), we are calling ExecutorStart() and ExecutorEnd()
> even if we are not doing EXPLAIN ANALYZE. Whereas, ExecutorRun() is called
> only if we are ANALYZEing.

>     Can we avoid calls to Executor{Start|End}() here, or is it necessary to
> call them even for non-ANALYZE case?

No; at least not unless you want to duplicate the permission-checking
machinery inside ExecutorStart.  Otherwise EXPLAIN could be used to
obtain information about tables you're not supposed to be able to read
(for instance, the estimated number of rows matching a WHERE condition
could be sensitive information).

Also, you'd have to uglify explain.c quite a lot to be able to handle
the case of traversing a plan tree without a matching planstate tree.
        regards, tom lane


Re: A question about ExplainOnePlan()

От
"Gurjeet Singh"
Дата:
On 12/13/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Gurjeet Singh" <singh.gurjeet@gmail.com> writes:
>     Can we avoid calls to Executor{Start|End}() here, or is it necessary to
> call them even for non-ANALYZE case?

No; at least not unless you want to duplicate the permission-checking
machinery inside ExecutorStart.  

I had seen the ExecCheckRTPerms() call inside InitPlan(), but didn't know that we considered even the EXPLAIN output to be so sensitive.

Otherwise EXPLAIN could be used to
obtain information about tables you're not supposed to be able to read
(for instance, the estimated number of rows matching a WHERE condition
could be sensitive information).

Also, you'd have to uglify explain.c quite a lot to be able to handle
the case of traversing a plan tree without a matching planstate tree.

Thanks.


--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | yahoo }.com

Re: A question about ExplainOnePlan()

От
Tom Lane
Дата:
"Gurjeet Singh" <singh.gurjeet@gmail.com> writes:
> On 12/13/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> No; at least not unless you want to duplicate the permission-checking
>> machinery inside ExecutorStart.

> I had seen the ExecCheckRTPerms() call inside InitPlan(), but didn't know
> that we considered even the EXPLAIN output to be so sensitive.

It's the same reason why pg_statistic isn't publicly readable.  The
standard example is that the min and max of an employee.salary column
are probably things that would be embarrassing to expose to everyone
in the company ...
        regards, tom lane