Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit87f2ad1

Browse files
committed
Fix plpgsql to release SPI plans when a function or DO block is freed.
This fixes the gripe I made a few months ago about DO blocks gettingslower with repeated use. At least, it fixes it for the case wherethe DO block isn't aborted by an error. We could try runningplpgsql_free_function_memory() even during error exit, but that seemsa bit scary since it makes a lot of presumptions about the datastructures being in good shape. It's probably reasonable to assumethat repeated failures of DO blocks isn't a performance-critical case.
1 parentde592e2 commit87f2ad1

File tree

4 files changed

+411
-5
lines changed

4 files changed

+411
-5
lines changed

‎src/pl/plpgsql/src/pl_comp.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,11 +2417,8 @@ delete_function(PLpgSQL_function *func)
24172417
plpgsql_HashTableDelete(func);
24182418

24192419
/* release the function's storage if safe and not done already */
2420-
if (func->use_count==0&&func->fn_cxt)
2421-
{
2422-
MemoryContextDelete(func->fn_cxt);
2423-
func->fn_cxt=NULL;
2424-
}
2420+
if (func->use_count==0)
2421+
plpgsql_free_function_memory(func);
24252422
}
24262423

24272424
/* exported so we can call it from plpgsql_init() */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp