enabling join_collapse_limit for a single query only

Started by Matt Harrisonover 16 years ago3 messagesgeneral
Jump to latest
#1Matt Harrison
groovefillet@gmail.com

Hi there,

Is it possible to set the runtime parameter 'join_collapse_limit' for
a single query only without setting/unsetting it before/after?

Thanks,
matt

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Matt Harrison (#1)
Re: enabling join_collapse_limit for a single query only

groovefillet wrote:

Is it possible to set the runtime parameter 'join_collapse_limit' for
a single query only without setting/unsetting it before/after?

Yes:

START TRANSACTION;

SET LOCAL join_collapse_limit = 42;

SELECT .....

COMMIT;

Yours,
Laurenz Albe

#3Matt Harrison
groovefillet@gmail.com
In reply to: Laurenz Albe (#2)
Re: enabling join_collapse_limit for a single query only

Hi, and thanks for the reply.

We're issuing queries from within our application where transactions
span a whole unit of work, so wrapping a single query in a transaction
just to set the param isn't really feasible except on a separate
connection, which i am loathe to do.

I was really hoping to be able to set join_collapse_limit=1 *just* on
the single query, as a kind of query hint, eg:

/* !hint:join_collapse_limit=1 */ SELECT ...

I take it this is this not possible in postgres?

cheers,
Matt h

On 23/07/2009, at 09:50, Albe Laurenz wrote:

Show quoted text

groovefillet wrote:

Is it possible to set the runtime parameter 'join_collapse_limit' for
a single query only without setting/unsetting it before/after?

Yes:

START TRANSACTION;

SET LOCAL join_collapse_limit = 42;

SELECT .....

COMMIT;

Yours,
Laurenz Albe