Skip to main content

All Questions

3 votes
1 answer
2k views

Why query in wrapped PLPGSQL function is much slower than itself?

Have been working with PostgreSQL 12.8 (Ubuntu 12.8-1.pgdg18.04+1) for a while. We have a significant time difference between normal queries and the same queries wrapped inside PLPGSQL functions with ...
IMAN4K's user avatar
  • 1,345
0 votes
2 answers
112 views

Why is FOR <query> LOOP is so much slower than basic query?

I write very simple plpgsql function which fetches each row from 25mln rows table and compare with prev row. If two sibling rows have equal "AOGUID" column they are returned. CREATE or replace ...
alexey2baranov's user avatar
0 votes
1 answer
3k views

Table Locking in PostgreSQL

I have a PL/pgSQL function which takes data from a staging table to our target table. The process executes every night. Sometimes due to server restart or some maintenance issues we get the process ...
Yousuf Sultan's user avatar