#1 2019-11-18 09:10:29

asmirnov
Member
Registered: 2018-06-05

PostgreSQL SET LOCAL in dynamic list

I need to tune query with incorrect estimate from query planner and would like to set transaction level parameter in postgresql (SET LOCAL ENABLE_NESTLOOP TO FALSE) in the same transaction as query,  or at least SET   ENABLE_NESTLOOP TO FALSE in the session. Reportserver covers queries inside external select, so i cannot put set to query text, can I define string to be executed before that select for example, or do it different way?

Offline

#2 2019-11-18 09:33:24

eduardo
Administrator
Registered: 2016-11-01
Website

Re: PostgreSQL SET LOCAL in dynamic list

Hi asmirnov,

can you please post an example of how the adapted query should look like? where exactly do you need these parameters?

Regards,
Eduardo

Offline

#3 2019-11-18 09:53:10

asmirnov
Member
Registered: 2018-06-05

Re: PostgreSQL SET LOCAL in dynamic list

Hi Eduardo,
Similar to following:

SET LOCAL ENABLE_NESTLOOP TO FALSE;
Select * from some_big_query_with_lots_of_joins

That means I forbid using nested loop join for current transaction (query).
For this certain query this setting makes it work much faster

Offline

#4 2019-11-18 09:56:39

eduardo
Administrator
Registered: 2016-11-01
Website

Re: PostgreSQL SET LOCAL in dynamic list

Hi asmirnov,

and "Select * from some_big_query_with_lots_of_joins" is the query created by reportserver, where you see your query as an internal query, correct?

Regards,
Eduardo

Offline

#5 2019-11-18 09:59:37

asmirnov
Member
Registered: 2018-06-05

Re: PostgreSQL SET LOCAL in dynamic list

Yes, right

Offline

#6 2019-11-18 10:04:17

eduardo
Administrator
Registered: 2016-11-01
Website

Re: PostgreSQL SET LOCAL in dynamic list

Hi asmirnov,

we have ticket RS-2406 for allowing to adapt the dynamic list query before its execution. So this would help you in this case.
I have prioritized this issue and will let you know when this feature is available.

Currently, the query created by reportserver can not be modified.

Regards,
Eduardo

Offline

#7 2019-11-18 10:55:04

asmirnov
Member
Registered: 2018-06-05

Re: PostgreSQL SET LOCAL in dynamic list

Thank you Eduardo

Probably there are some other ways, for example execute SET statement on session level on the connection initialize, or  using hook in the report?

Offline

#8 2019-11-19 07:54:25

eduardo
Administrator
Registered: 2016-11-01
Website

Re: PostgreSQL SET LOCAL in dynamic list

Hi asmirnov,

maybe you can set this in your postgres.conf file or via jdbc url parameter. Can you please check this?

Regards,
Eduardo

Offline

#9 2019-12-13 12:20:32

asmirnov
Member
Registered: 2018-06-05

Re: PostgreSQL SET LOCAL in dynamic list

eduardo wrote:

Hi asmirnov,

maybe you can set this in your postgres.conf file or via jdbc url parameter. Can you please check this?

Regards,
Eduardo

Finally, we disabled server-level parameter. It won;t work always,  but mostly Ok in our case.

Offline

#10 2020-03-18 08:23:45

eduardo
Administrator
Registered: 2016-11-01
Website

Re: PostgreSQL SET LOCAL in dynamic list

Hi asmirnov,

just a quick information:
we are looking into this in ticket RS-3994. The other ticket number I mentioned is a similar issue, but it doesn't solve your problem.

Regards,
Eduardo

Offline

Board footer

Powered by FluxBB