CREATE OR REPLACE procedure reception_get_changes()
LANGUAGE 'plpgsql'
SECURITY DEFINER
AS
$BODY$
BEGIN
--Cоздаем основную таблицу с данными
create table test_part_prunning
(id int,
val text) on commit drop;
--Наполняем
insert into test_part_prunning
select (array[1,2,3,4,5])[floor(random()*5+1)],
md5(random()::text)
from generate_series(1, 100000) as n;
vacuum analyze test_part_prunning;
END;
$BODY$;
perform reception_get_changes();
SELECT * FROM test_part_prunning x;
perform reception_get_changes();