Re: proposal: set GUC variables for single query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
Cc: Jan Urbański <wulczer(at)wulczer(dot)org>, Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: set GUC variables for single query
Date: 2011-10-16 20:58:55
Message-ID: 2120.1318798735@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr> writes:
> Now that you mention it, the following might actually already work:

> WITH settings AS (
> SELECT set_config('timezone', 'Europe/Amsterdam', t),
> set_config('work_mem', '1 GB', t)
> ),
> foo AS (
> SELECT
> )
> INSERT INTO bar SELECT * FROM foo;

Only for small values of "work" ... you won't be able to affect planner
settings that way, nor can you assume that that WITH item is executed
before all else. See recent thread pointing out that setting values
mid-query is unsafe.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2011-10-16 21:43:05 Re: GiST for range types (was Re: Range Types - typo + NULL string constructor)
Previous Message Dimitri Fontaine 2011-10-16 20:27:32 Re: proposal: set GUC variables for single query