Re: wrong search_path being used

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <kgrittn(at)mail(dot)com>, Rodrigo Rosenfeld Rosas <rr(dot)rosas(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: wrong search_path being used
Date: 2013-01-13 20:27:53
Message-ID: CAFj8pRCrXCZdFU-tgHqw+_xX7-1qWzovYJzU1fJYukr4wx4w6A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

2013/1/13 Andres Freund <andres(at)2ndquadrant(dot)com>:
> On 2013-01-12 15:13:51 -0500, Tom Lane wrote:
>> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
>> > On 2013-01-12 14:29:38 -0500, Tom Lane wrote:
>> >> I think that the alternative most likely to succeed is to consider any
>> >> change in the active value of search_path as forcing replanning of
>> >> cached plans.
>>
>> > I guess it wouldn't really be feasible to keep the search path used to
>> > plan a query in its cached form and check that it fits the one currently
>> > used on every use of the cached plan?
>>
>> Actually that's exactly what I meant: every time we arrive at a query
>> with a cached plan, check to see if the active search_path value is the
>> same as what it was when we made the cached plan, and replan if not.
>
> Okay. I was afraid it would add noticeable overhead to stuff like
> plpgsql... Maybe would lower that by having a "search_path" generation
> counter that gets increased everytime it gets changed but that seems a
> bit too complicated.
>

we can use same mechanism, that is used for plpgsql polymorphic
functions - different parameters => different instances of plpgsql
function.

we can store n instances per function - probably there can be memory
issues when too much different search paths will be used - it is
optimal probably for 10 - 100 different search paths

different solution - can we specify search_path early in connection
string? Then this information can be used by connection pooler - and
we can do replan when different search_path is identified.

Regards

Pavel

> Greetings,
>
> Andres Freund
>
> --
> Andres Freund http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message dotbrat 2013-01-14 05:28:48 BUG #7804: timeofday() output string is not compatible with "timestamp with time zone" data type
Previous Message Andres Freund 2013-01-13 20:18:26 Re: wrong search_path being used