<html><head><title>Re: [GENERAL] Memory usage per session</title>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
</head>
<body>
<span style=" font-family:'Courier New'; font-size: 9pt;">Здравствуйте.<br>
<br>
>> Oracle: about 5M<br>
>> postgreSql: about 160М<br>
<br>
<br>
>I'm admittedly ignorant of this type of testing. But if the memory usage for PostgreSQL is in the server, perhaps due to caching (how to test?), then it likely would _not_ linearly scale up >as the number of clients increased because every clients >would share the same cache data within the server. Or are you measuring the memory usage where the client is on one machine and the >PostgreSQL server is a different machine, with the client machine getting the memory hit?<br>
<br>
I can send zip file with test code on request;<br>
To say the truth it's described in documentation:<br>
https://www.postgresql.org/docs/9.5/static/plpgsql-implementation.html#PLPGSQL-PLAN-CACHING<br>
The PL/pgSQL interpreter parses the function's source text and produces an internal binary instruction tree the first time the function is called (within each session) <br>
<br>
It's very sad :(<br>
<br>
The test is very simply:<br>
Generate code:<br>
DECLARE<br>
svSql "varchar";<br>
BEGIN<br>
for nvi in 1..10<br>
loop<br>
svSql = 'CREATE OR REPLACE FUNCTION perfa."func'||nvi||'" (<br>
)<br>
RETURNS void AS<br>
$body$<br>
DECLARE<br>
svSql "varchar";<br>
BEGIN<br>
svSql:='''';<br>
PERFORM perfb."func'||(nvi-1)*10+1||'"();<br>
PERFORM perfb."func'||(nvi-1)*10+2||'"();<br>
PERFORM perfb."func'||(nvi-1)*10+3||'"();<br>
PERFORM perfb."func'||(nvi-1)*10+4||'"();<br>
PERFORM perfb."func'||(nvi-1)*10+5||'"();<br>
PERFORM perfb."func'||(nvi-1)*10+6||'"();<br>
PERFORM perfb."func'||(nvi-1)*10+7||'"();<br>
PERFORM perfb."func'||(nvi-1)*10+8||'"();<br>
PERFORM perfb."func'||(nvi-1)*10+9||'"();<br>
PERFORM perfb."func'||(nvi-1)*10+10||'"(); <br>
END;<br>
$body$<br>
LANGUAGE ''plpgsql''<br>
VOLATILE<br>
CALLED ON NULL INPUT<br>
SECURITY INVOKER';<br>
EXECUTE svSql;<br>
end loop;<br>
END;<br>
<br>
Download jmetter<br>
In 50 thread run this funciton.<br>
<br>
<br>
About 4g memory will be consumed in one second <br>
It's hard to miss<br>
:))<br>
<br>
</body></html>