All Questions
Tagged with postgresql-performance plpgsql
9 questions
1
vote
1
answer
224
views
Do multiple regex changes in one update with the help of plpgsql
I'm looking for some tips to get this PostgreSQL plpgsql function to work. I would like to do a couple of regex's on each record and update only one time as doing them one by one takes 15 min. ...
...
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 ...
3
votes
3
answers
8k
views
To sort the letters in a string alphabetically in PostgreSQL
I am currently using this method to sort letters in a string alphabetically in PostgreSQL. Are there any other efficient methods?
select string_agg(c, '') as s
from (select unnest(...
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 ...
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 ...
10
votes
2
answers
15k
views
Execute multiple functions together without losing performance
I have this process that has to make a series of queries, using pl/pgsql:
--process:
SELECT function1();
SELECT function2();
SELECT function3();
SELECT function4();
To be able to execute everything ...
-1
votes
2
answers
2k
views
Why postgres function so slow but single query is fast?
I have function to get employee in 'Create' status.
CREATE OR REPLACE FUNCTION get_probation_contract(AccountOrEmpcode TEXT, FromDate DATE,
...
0
votes
2
answers
345
views
Why does this function get exponentially more expensive?
If I create a function that loops through executing a bunch of dynamic queries, the process time seems to get exponentially larger. For the sake of an example, im going to use the following code. Keep ...
2
votes
1
answer
551
views
Replace looping with a single query for INSERT / UPDATE
I am writing a function in PostgreSQL. It does basically 3 steps:
Fetch a record from source table.
check the value from the fetched record in target table, if record is found in target table then ...