Postgresql 16.3 Out Of Memory

2024-06-03 Thread Radu Radutiu
Hello, I have an out of memory problem after upgrading from postgresql 12 to 16.3. I have identified one query that can reproduce the error on demand. Once the query starts, it will eventually exhaust all RAM and swap until the OOM killer will stop postgresql. The setup is as follows: - One VMWARE

Re: Postgresql 16.3 Out Of Memory

2024-06-03 Thread Greg Sabino Mullane
On Mon, Jun 3, 2024 at 6:19 AM Radu Radutiu wrote: > Do you have any idea how to further debug the problem? > Putting aside the issue of non-reclaimed memory for now, can you show us the actual query? The explain analyze you provided shows it doing an awful lot of joins and then returning 14+ mi

Re: Postgresql 16.3 Out Of Memory

2024-06-03 Thread Ron Johnson
On Mon, Jun 3, 2024 at 9:12 AM Greg Sabino Mullane wrote: > On Mon, Jun 3, 2024 at 6:19 AM Radu Radutiu wrote: > >> Do you have any idea how to further debug the problem? >> > > Putting aside the issue of non-reclaimed memory for now, can you show us > the actual query? The explain analyze you p

Unexpected results from CALL and AUTOCOMMIT=off

2024-06-03 Thread Victor Yegorov
Greetings. I am observing the following results on PostgreSQL 15.7 First, setup: create table t_test(x bigint); insert into t_test values(0); create or replace function f_get_x() returns bigint language plpgsql stable as $function$ declare l_result bigint; begin select x into l_result fr

Re: Unexpected results from CALL and AUTOCOMMIT=off

2024-06-03 Thread Pierre Forstmann
You declared function f_get_x as stable which means: https://www.postgresql.org/docs/15/sql-createfunction.html STABLE indicates that the function cannot modify the database, and that within a single table scan it will consistently return the same result for the same argument values, but that its

Re: Unexpected results from CALL and AUTOCOMMIT=off

2024-06-03 Thread Victor Yegorov
пн, 3 июн. 2024 г. в 20:40, Pierre Forstmann : > You declared function f_get_x as stable which means: > > … > > If you remove stable from function declaration, it works as expected: > Well, I checked https://www.postgresql.org/docs/current/xfunc-volatility.html There's a paragraph describing why

Re: Unexpected results from CALL and AUTOCOMMIT=off

2024-06-03 Thread Tom Lane
Victor Yegorov writes: > пн, 3 июн. 2024 г. в 20:40, Pierre Forstmann : >> If you remove stable from function declaration, it works as expected: > ... therefore I assume STABLE should work in this case. Well, it seems not > to. I agree that this looks like a bug, since your example shows that th