Re: Notes about Pl/PgSQL assignment performance

2017-12-19 Thread Alvaro Herrera
Andrey Zhidenkov wrote: > I've digged into the source code a little bit and found that chain: > > PLPGSQL_STMT_ASSIGN -> exec_stmt_assign() -> exec_assign_expr() > -> exec_eval_expr() -> exec_run_select() > -> SPI_execute_plan_with_paramlist() -> _SPI_execute_plan() which finnaly > calls PushActiv

Re: Notes about Pl/PgSQL assignment performance

2017-12-19 Thread David Rowley
On 20 December 2017 at 02:48, Andrey Zhidenkov wrote: > PLPGSQL_STMT_ASSIGN -> exec_stmt_assign() -> exec_assign_expr() -> > exec_eval_expr() -> exec_run_select() -> SPI_execute_plan_with_paramlist() > -> _SPI_execute_plan() which finnaly calls PushActiveSnapshot() and > PopActiveSnapshot() wich j

Re: Notes about Pl/PgSQL assignment performance

2017-12-19 Thread Andrey Zhidenkov
I've digged into the source code a little bit and found that chain: PLPGSQL_STMT_ASSIGN -> exec_stmt_assign() -> exec_assign_expr() -> exec_eval_expr() -> exec_run_select() -> SPI_execute_plan_with_paramlist() -> _SPI_execute_plan() which finnaly calls PushActiveSnapshot() and PopActiveSnapshot()

Re: Notes about Pl/PgSQL assignment performance

2017-12-19 Thread Alvaro Herrera
Andrey Zhidenkov wrote: > When I run this test in 2 threads I expect that running time will be the > same, because PostgreSQL will fork process for the second connection and > this process will be served by a separate CPU core because I have more than > 2 cores. > Yes, IMMUTABLE flag helps, but I t

Re: Notes about Pl/PgSQL assignment performance

2017-12-19 Thread Pavel Stehule
2017-12-19 12:46 GMT+01:00 Pavel Stehule : > > > 2017-12-19 12:40 GMT+01:00 Hannu Krosing : > >> On 19.12.2017 11:36, Pavel Stehule wrote: >> >> Hi >> >> 2017-12-19 12:28 GMT+01:00 Андрей Жиденков : >> >>> Few day ago a faced a problem: Pl/PgSQL procedure works slower when >>> running in parallel

Re: Notes about Pl/PgSQL assignment performance

2017-12-19 Thread Pavel Stehule
2017-12-19 12:45 GMT+01:00 Andrey Zhidenkov : > When I run this test in 2 threads I expect that running time will be the > same, because PostgreSQL will fork process for the second connection and > this process will be served by a separate CPU core because I have more than > 2 cores. > Yes, IMMUTA

Re: Notes about Pl/PgSQL assignment performance

2017-12-19 Thread Pavel Stehule
2017-12-19 12:40 GMT+01:00 Hannu Krosing : > On 19.12.2017 11:36, Pavel Stehule wrote: > > Hi > > 2017-12-19 12:28 GMT+01:00 Андрей Жиденков : > >> Few day ago a faced a problem: Pl/PgSQL procedure works slower when >> running in parallel threads. I found the correlation between number of >> assig

Re: Notes about Pl/PgSQL assignment performance

2017-12-19 Thread Andrey Zhidenkov
When I run this test in 2 threads I expect that running time will be the same, because PostgreSQL will fork process for the second connection and this process will be served by a separate CPU core because I have more than 2 cores. Yes, IMMUTABLE flag helps, but I think It's just because Postgres ac

Re: Notes about Pl/PgSQL assignment performance

2017-12-19 Thread Hannu Krosing
On 19.12.2017 11:36, Pavel Stehule wrote: > Hi > > 2017-12-19 12:28 GMT+01:00 Андрей Жиденков >: > > Few day ago a faced a problem: Pl/PgSQL procedure works slower > when running in parallel threads. I found the correlation between > number of assignments in

Re: Notes about Pl/PgSQL assignment performance

2017-12-19 Thread Pavel Stehule
Hi 2017-12-19 12:28 GMT+01:00 Андрей Жиденков : > Few day ago a faced a problem: Pl/PgSQL procedure works slower when > running in parallel threads. I found the correlation between number of > assignments in procedure code and performance. I decided to write the > simple benchmark procedures and