On 20 December 2017 at 02:48, Andrey Zhidenkov <pensna...@gmail.com> 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 just do memory context allocations and use malloc() > to copy snaphot.
Probably the best thing to do is to look at which functions are taking the most time by doing a perf record for a single running instance, then the same again with multiple instances running. Perhaps something in there might appear in the samples more often with the multiple instances than it does with a single instance. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services