{"id":435893,"date":"2024-10-18T09:00:56","date_gmt":"2024-10-18T09:00:56","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=435893"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=435893","title":{"rendered":"<span>\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0441\u0442\u0440\u0435\u0441\u0441-\u0442\u0435\u0441\u0442\u0430 \u0421\u0423\u0411\u0414<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043a \u0421\u0423\u0411\u0414 , \u043f\u0440\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 .<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0421\u0423\u0411\u0414 \u00a0<a href=\"https:\/\/habr.com\/ru\/articles\/850106\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0421\u0423\u0411\u0414 \u2014 \u0440\u0430\u0441\u0447\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0430\u043d\u0430\u043b\u0438\u0437, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \/ \u0425\u0430\u0431\u0440 (habr.com)<\/a>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0421\u0423\u0411\u0414 &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u00a0<a href=\"https:\/\/postgrespro.ru\/docs\/enterprise\/16\/pgbench\" rel=\"noopener noreferrer nofollow\"><strong>pgbench<\/strong><\/a><\/p>\n<h4>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b<\/h4>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 <a href=\"https:\/\/habr.com\/ru\/articles\/851092\/\" rel=\"noopener noreferrer nofollow\">\u042d\u0442\u044e\u0434: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u043e\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0421\u0423\u0411\u0414 \/ \u0425\u0430\u0431\u0440 (habr.com)<\/a>  <\/p>\n<h2>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0442\u0435\u0441\u0442\u0430<\/h2>\n<p><strong>1.\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430 \u0421\u0423\u0411\u0414 <\/strong><\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a pgbench c \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 client:  <\/p>\n<pre><code class=\"bash\">--client=\u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0427\u0438\u0441\u043b\u043e \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0430\u043d\u0441\u043e\u0432 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.\u00a0<\/code><\/pre>\n<p><strong>2.\u041f\u0435\u0440\u0438\u043e\u0434 \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0434\u043e\u043b\u0433\u043e\u0439 \u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0439<\/strong><\/p>\n<p><strong>3.\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430<\/strong><\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f <strong>pgbench <\/strong>\u0441 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u043c \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <strong>client = \u0418\u0442\u0435\u0440\u0430\u0446\u0438\u044f  * 40<\/strong> <\/p>\n<p><strong>4.\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0442\u0435\u0441\u0442\u0430<\/strong><\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <a href=\"https:\/\/e.vyatsu.ru\/pluginfile.php\/462616\/mod_resource\/content\/3\/%D0%A2%D0%B5%D0%BE%D1%80%D0%B5%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9%20%D0%BC%D0%B0%D1%82%D0%B5%D1%80%D0%B8%D0%B0%D0%BB_%D0%BA%D0%BE%D1%80%D1%80%D0%B5%D0%BB%D1%8F%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9%20%D0%B0%D0%BD%D0%B0%D0%BB%D0%B8%D0%B7.pdf?ysclid=m2eanieoxa124041710\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438<\/a> \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0435\u0441\u0441\u0438\u0439 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u043b\u0433\u043e\u0439 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0439 <strong>R<sub>xy <\/sub>&lt; -0.7<\/strong><\/p>\n<p><strong>5.\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 <\/strong><\/p>\n<p>\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430  <strong>client <\/strong>\u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f  <strong>pgbench.<\/strong>( \u041f\u0443\u043d\u043a\u0442 3.).<\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u0441\u0442\u0430<\/h2>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0411\u0414 \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <\/h3>\n<details class=\"spoiler\">\n<summary>stress_base.create_db.sh<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh # stress_base.create_db.sh # version 8.4 # \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0411\u0414 # \u0418\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0411\u0414   #\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430  function exit_code { ecode=$1 if [[ $ecode != 0 ]]; then ecode=$1 LOG_FILE=$2 ERR_FILE=$3  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE &gt;&gt; $LOG_FILE      exit $ecode fi }  script=$(readlink -f $0) current_path=`dirname $script`  LOG_FILE=$current_path'\/stress_base.create_db.log' ERR_FILE=$current_path'\/stress_base.create_db.err' PROGRESS_FILE=$current_path'\/start_pg_bench.progress'  timestamp_label=$(date \"+%Y%m%d\")'T'$(date \"+%H%M%S\")  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : STARTED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : STARTED '&gt; $LOG_FILE      echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench CREATION IS STARTED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench CREATION IS STARTED ' &gt;&gt; $LOG_FILE     psql -c \"DROP DATABASE IF EXISTS test_pgbench\" 2&gt;&gt;$ERR_FILE exit_code $? $LOG_FILE $ERR_FILE  psql -c \"CREATE DATABASE test_pgbench WITH OWNER = pgpropwr\" 2&gt;&gt;$ERR_FILE exit_code $? $LOG_FILE $ERR_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench HAS BEEN CREATED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench HAS BEEN CREATED ' &gt;&gt; $LOG_FILE  ################### # \u041f\u0410\u0420\u0410\u041c\u0415\u0422\u0420\u042b \u0422\u0415\u0421\u0422\u041e\u0412\u041e\u0413\u041e \u0421\u0426\u0415\u041d\u0410\u0420\u0418\u042f let pgbench_clients=`cat $current_path'\/pgbench_clients'` let transactions=`cat $current_path'\/transactions'` ###################  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_clients = '$pgbench_clients echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_clients = '$pgbench_clients &gt;&gt; $LOG_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : transactions = '$transactions echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : transactions = '$transactions &gt;&gt; $LOG_FILE  ######################################################################################################### #\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 pgbench_init_param='--quiet --foreign-keys --scale='\"$pgbench_clients\"' -i test_pgbench'  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_init_param= '$pgbench_init_param echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_init_param= '$pgbench_init_param&gt;&gt; $LOG_FILE   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench STARTED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench STARTED' &gt;&gt; $LOG_FILE  pgbench --username=pgpropwr $pgbench_init_param &gt;&gt;$LOG_FILE 2&gt;&gt;$PROGRESS_FILE exit_code $? $LOG_FILE $PROGRESS_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench FINISHED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench FINISHED' &gt;&gt; $LOG_FILE  exit 0 <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <\/h3>\n<details class=\"spoiler\">\n<summary>stress_base.sh<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh # stress_base.sh # version 8.4 # \u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0411\u0414 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e # \u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0411\u0414 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e # VACUUM ANALYZE \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 # \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0421\u0423\u0411\u0414 - \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e # \u0411\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e # touch \/postgres\/scripts\/pgbench\/STOP_PGBENCH  #\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430  function exit_code { ecode=$1 if [[ $ecode != 0 ]]; then ecode=$1 LOG_FILE=$2 ERR_FILE=$3  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE &gt;&gt; $LOG_FILE      exit $ecode fi }  script=$(readlink -f $0) current_path=`dirname $script`  LOG_FILE=$current_path'\/stress_base.log'  timestamp_label=$(date \"+%Y%m%d\")'T'$(date \"+%H%M%S\")  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : STARTED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : STARTED '&gt; $LOG_FILE  #\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0439 \u0444\u043b\u0430\u0433 if [ -f \/postgres\/scripts\/pgbench\/STOP_PGBENCH ];  then   rm \/postgres\/scripts\/pgbench\/STOP_PGBENCH fi  #\u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 touch \/postgres\/scripts\/stress\/STRESS_NOT_STARTED ;  ################### # \u041f\u0410\u0420\u0410\u041c\u0415\u0422\u0420\u042b \u0422\u0415\u0421\u0422\u041e\u0412\u041e\u0413\u041e \u0421\u0426\u0415\u041d\u0410\u0420\u0418\u042f let pgbench_clients=`cat $current_path'\/pgbench_clients'` let transactions=`cat $current_path'\/transactions'` ###################  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench_clients = '$pgbench_clients echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench_clients = '$pgbench_clients &gt;&gt; $LOG_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : transactions = '$transactions echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : transactions = '$transactions &gt;&gt; $LOG_FILE   RESULT_LOG_FILE=$current_path'\/result.log' echo $(date \"+%d-%m-%Y %H:%M:%S\")' | stress_base | ' &gt; $RESULT_LOG_FILE echo ' timestamp | response time | response time sort | response time long | CPI | Active | CPI MM short  | Active short  | CPI MM short\/Active short correlation | CPI MM long  | Active long  | CPI MM short\/Active long correlation |' &gt;&gt; $RESULT_LOG_FILE   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432: '$pgbench_clients echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432: '$pgbench_clients &gt;&gt; $LOG_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439: '$transactions echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439: '$transactions &gt;&gt; $LOG_FILE   #--jobs=\u043f\u043e\u0442\u043e\u043a\u0438 \u0427\u0438\u0441\u043b\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 pgbench. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445 jobs=`cat \/proc\/cpuinfo|grep processor|wc -l` echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : jobs= '$jobs echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : jobs= '$jobs&gt;&gt; $LOG_FILE    ERR_FILE=$current_path'\/stress_base.err' PROGRESS_FILE=$current_path'\/stress_base.progress' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") &gt; $ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") &gt; $PROGRESS_FILE  pgbench_param='--protocol=extended --report-per-command --jobs='\"$jobs\"' --client='\"$pgbench_clients\"' --transactions='\"$transactions\"' test_pgbench'      echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench_param= '$pgbench_param echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench_param= '$pgbench_param&gt;&gt; $LOG_FILE    let counter=1 while [ 1 = 1 ] do  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : iteration '$counter' - STARTED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : iteration '$counter' - STARTED' &gt;&gt; $LOG_FILE  ###################################################### if [ -f \/postgres\/scripts\/pgbench\/STOP_PGBENCH ];  then   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench has been stopped '   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench has been stopped '&gt;&gt; $LOG_FILE      echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : FINISHED '   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : FINISHED '&gt;&gt; $LOG_FILE    rm $ERR_FILE      exit 0 fi  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench STARTED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench STARTED' &gt;&gt; $LOG_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench progress stored in file :'$PROGRESS_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench progress stored in file :'$PROGRESS_FILE  &gt;&gt; $LOG_FILE  pgbench --username=pgpropwr $pgbench_param &gt;&gt;$LOG_FILE 2&gt;&gt;$PROGRESS_FILE exit_code $? $LOG_FILE $PROGRESS_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench FINISHED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench FINISHED' &gt;&gt; $LOG_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : iteration '$counter' - FINISHED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : iteration '$counter' - FINISHED' &gt;&gt; $LOG_FILE let counter=$counter+1 ######################################################  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : VACUUM ANALYZE : STARTED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : VACUUM ANALYZE : STARTED' &gt;&gt; $LOG_FILE  psql -d test_pgbench -c 'VACUUM ANALYZE' &gt;&gt;$LOG_FILE 2&gt;&gt;$PROGRESS_FILE exit_code $? $LOG_FILE $PROGRESS_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : VACUUM ANALYZE : FINISHED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : VACUUM ANALYZE : FINISHED' &gt;&gt; $LOG_FILE    done  exit 0 <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438:<\/strong><\/p>\n<p><code>pgbench_clients<\/code> <strong>100<\/strong><\/p>\n<p><code>transactions<\/code>  <strong>10000<\/strong><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0411\u0414 \u0434\u043b\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <\/h3>\n<details class=\"spoiler\">\n<summary>stress_additional.create_db.sh<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh # stress_additional.create_db.sh # version 11 # \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0411\u0414 # \u0418\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0411\u0414   #\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430  function exit_code { ecode=$1 if [[ $ecode != 0 ]]; then ecode=$1 LOG_FILE=$2 ERR_FILE=$3  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE &gt;&gt; $LOG_FILE      exit $ecode fi }  script=$(readlink -f $0) current_path=`dirname $script`  LOG_FILE=$current_path'\/stress_additional.create_db.log' ERR_FILE=$current_path'\/stress_additional.create_db.err' PROGRESS_FILE=$current_path'\/start_pg_bench.progress'  timestamp_label=$(date \"+%Y%m%d\")'T'$(date \"+%H%M%S\")  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : STARTED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : STARTED '&gt; $LOG_FILE   ################### # \u041f\u0410\u0420\u0410\u041c\u0415\u0422\u0420\u042b \u0422\u0415\u0421\u0422\u041e\u0412\u041e\u0413\u041e \u0421\u0426\u0415\u041d\u0410\u0420\u0418\u042f let pgbench_clients=`cat $current_path'\/pgbench_clients'` ###################     echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench11 CREATION IS STARTED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench11 CREATION IS STARTED ' &gt;&gt; $LOG_FILE     psql -c \"DROP DATABASE IF EXISTS test_pgbench11\" 2&gt;&gt;$ERR_FILE exit_code $? $LOG_FILE $ERR_FILE  psql -c \"CREATE DATABASE test_pgbench11 WITH OWNER = pgpropwr\" 2&gt;&gt;$ERR_FILE exit_code $? $LOG_FILE $ERR_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench11 HAS BEEN CREATED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench11 HAS BEEN CREATED ' &gt;&gt; $LOG_FILE   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_clients = '$pgbench_clients echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_clients = '$pgbench_clients &gt;&gt; $LOG_FILE  ######################################################################################################### #\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 pgbench_init_param='--quiet --foreign-keys --scale='\"$pgbench_clients\"' -i test_pgbench11'  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_init_param= '$pgbench_init_param echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_init_param= '$pgbench_init_param&gt;&gt; $LOG_FILE   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench STARTED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench STARTED' &gt;&gt; $LOG_FILE  pgbench --username=pgpropwr $pgbench_init_param &gt;&gt;$LOG_FILE 2&gt;&gt;$PROGRESS_FILE exit_code $? $LOG_FILE $PROGRESS_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench FINISHED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench FINISHED' &gt;&gt; $LOG_FILE         exit 0 <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <\/h3>\n<details class=\"spoiler\">\n<summary>stress_additional.sh<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh # stress_additional.sh # version 11.0 # \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430  # \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b : \u0432\u0440\u0435\u043c\u044f clients   #\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430  function exit_code { ecode=$1 if [[ $ecode != 0 ]]; then ecode=$1 LOG_FILE=$2 ERR_FILE=$3  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE &gt;&gt; $LOG_FILE      exit $ecode fi }  script=$(readlink -f $0) current_path=`dirname $script`  LOG_FILE=$current_path'\/stress_additional.log'  timestamp_label=$(date \"+%Y%m%d\")'T'$(date \"+%H%M%S\")  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : STARTED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : STARTED '&gt;&gt; $LOG_FILE  test_time=$1 clients=$2  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : \u0412\u0440\u0435\u043c\u044f \u0442\u0435\u0441\u0442\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445: '$test_time echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : \u0412\u0440\u0435\u043c\u044f \u0442\u0435\u0441\u0442\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445: '$test_time &gt;&gt; $LOG_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432: '$clients echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432: '$clients &gt;&gt; $LOG_FILE   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : \u041f\u0440\u043e\u0445\u043e\u0434: '$connect_count echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : \u041f\u0440\u043e\u0445\u043e\u0434: '$connect_count &gt;&gt; $LOG_FILE  ##################################################################################   #--jobs=\u043f\u043e\u0442\u043e\u043a\u0438 \u0427\u0438\u0441\u043b\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 pgbench. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445 jobs=`cat \/proc\/cpuinfo|grep processor|wc -l` echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : jobs= '$jobs echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : jobs= '$jobs&gt;&gt; $LOG_FILE  pg_bench_time=$1 let pgbench_clients=$2   ################## ERR_FILE=$current_path'\/stress_additional.err' PROGRESS_FILE=$current_path'\/stress_additional.progress' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") &gt; $ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") &gt; $PROGRESS_FILE  pgbench_param='--protocol=extended --report-per-command --jobs='\"$jobs\"' --client='\"$pgbench_clients\"' --time='\"$pg_bench_time\"' test_pgbench11'  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : pgbench_param= '$pgbench_param echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : pgbench_param= '$pgbench_param&gt;&gt; $LOG_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : pg_bench STARTED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : pg_bench STARTED' &gt;&gt; $LOG_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : pg_bench progress stored in file :'$PROGRESS_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : pg_bench progress stored in file :'$PROGRESS_FILE  &gt;&gt; $LOG_FILE pgbench --username=pgpropwr $pgbench_param &gt;&gt;$LOG_FILE 2&gt;&gt;$PROGRESS_FILE exit_code $? $LOG_FILE $PROGRESS_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : pg_bench FINISHED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : pg_bench FINISHED' &gt;&gt; $LOG_FILE  ################################################################################## echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : FINISHED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : FINISHED '&gt;&gt; $LOG_FILE  ###################################################### if [ -f \/postgres\/scripts\/pgbench\/STOP_PGBENCH ];  then   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : pgbench has been stopped '   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : pgbench has been stopped '&gt;&gt; $LOG_FILE      echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : FINISHED '   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_additional : OK : FINISHED '&gt;&gt; $LOG_FILE    rm $ERR_FILE      exit 0 fi   rm $ERR_FILE exit 0 <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <\/h3>\n<details class=\"spoiler\">\n<summary>stress_start.sh<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh # stress_start.sh # version 12 # \u0421\u0442\u0440\u0435\u0441\u0441 - \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 # \u0411\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e # touch \/postgres\/scripts\/pgbench\/STOP_PGBENCH  #\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430  function exit_code { ecode=$1 if [[ $ecode != 0 ]]; then ecode=$1 LOG_FILE=$2 ERR_FILE=$3  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE &gt;&gt; $LOG_FILE      exit $ecode fi }  script=$(readlink -f $0) current_path=`dirname $script`  LOG_FILE=$current_path'\/stress_start.log' RESULT_LOG_FILE=$current_path'\/result.log'  timestamp_label=$(date \"+%Y%m%d\")'T'$(date \"+%H%M%S\")  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_start : OK : STARTED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_start : OK : STARTED '&gt; $LOG_FILE  #\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0439 \u0444\u043b\u0430\u0433 if [ -f \/postgres\/scripts\/pgbench\/STOP_PGBENCH ];  then   rm \/postgres\/scripts\/pgbench\/STOP_PGBENCH fi   ERR_FILE=$current_path'\/stress_start.err' PROGRESS_FILE=$current_path'\/stress_start.progress' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") &gt; $ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") &gt; $PROGRESS_FILE  cd $current_path  RESULT_LOG_FILE=$current_path'\/result.log' echo $(date \"+%d-%m-%Y %H:%M:%S\")' | stress_start | ' &gt;&gt; $RESULT_LOG_FILE  let counter=1 while [ 1 = 1 ] do  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_start : OK : iteration '$counter' - STARTED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_start : OK : iteration '$counter' - STARTED' &gt;&gt; $LOG_FILE  ###################################################### if [ -f \/postgres\/scripts\/pgbench\/STOP_PGBENCH ];  then   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_start : OK : pgbench has been stopped '   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_start : OK : pgbench has been stopped '&gt;&gt; $LOG_FILE      echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_start : OK : FINISHED '   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_start : OK : FINISHED '&gt;&gt; $LOG_FILE    rm $ERR_FILE      exit 0 fi  ################################## # \u0421\u0442\u0430\u0440\u0442 \u0441\u0442\u0440\u0435\u0441\u0441\u043e\u0432\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438  # 10 \u043c\u0438\u043d\u0443\u0442  # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 = counter*40 let clients=counter*40 .\/stress_additional.sh 600 $clients  let counter=$counter+1  done  exit 0 <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0442\u0435\u0441\u0442\u0430<\/h3>\n<details class=\"spoiler\">\n<summary>stress.log.sh<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh # stress.log.sh # version 12 # \u041b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 # \u0411\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. # \u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0442\u0435\u0441\u0442\u0430 - touch \/postgres\/scripts\/pgbench\/STOP_PGBENCH  #\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430  function exit_code { ecode=$1 if [[ $ecode != 0 ]]; then ecode=$1 LOG_FILE=$2 ERR_FILE=$3  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE &gt;&gt; $LOG_FILE      exit $ecode fi }  script=$(readlink -f $0) current_path=`dirname $script`  if [ -f \/postgres\/scripts\/pgbench\/STOP_PGBENCH ];  then   exit 0 fi  RESULT_LOG_FILE=$current_path'\/result.log' ERR_FILE=$current_path'\/result.err' PROGRESS_FILE=$current_path'\/result.progress'   result_str=`psql -Aqtc 'select unnest(backrest.cpi_mm_active_report())' 2&gt;$ERR_FILE` exit_code $? $LOG_FILE $PROGRESS_FILE  echo $result_str &gt;&gt; $RESULT_LOG_FILE   signal=`echo $result_str | awk -F '|' '{print $13}' `  echo 'signal='$signal  #\u0415\u0441\u043b\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 , \u0435\u0449\u0435 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043e if [ -f \/postgres\/scripts\/stress\/STRESS_NOT_STARTED ];  then   exit 0 fi   if [ \"$signal\" ==  'SIGNAL' ] then echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' | ATTENTION : STRONG NEGATIVE CORRELATION  !!! | ' &gt;&gt; $RESULT_LOG_FILE     touch \/postgres\/scripts\/pgbench\/STOP_PGBENCH fi  rm $ERR_FILE  exit 0   <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u0441\u0442\u0430<\/h2>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0438 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043c\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0434\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430. <\/p>\n<p><strong>\u0427\u0430\u0441\u0442\u043e\u0442\u0430 \u0437\u0430\u043c\u0435\u0440\u043e\u0432 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439 = 1 \u043c\u0438\u043d\u0443\u0442\u0430. <\/strong><\/p>\n<p><strong>\u041f\u0435\u0440\u0438\u043e\u0434 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043b\u0433\u043e\u0439 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0439 = 1 \u0447\u0430\u0441.<\/strong><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8ee\/c35\/ade\/8eec35adefdf3b432d15b9088ec68b74.png\" alt=\"\u0420\u0438\u0441.1. \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0421\u0423\u0411\u0414\" title=\"\u0420\u0438\u0441.1. \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0421\u0423\u0411\u0414\" width=\"1394\" height=\"805\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8ee\/c35\/ade\/8eec35adefdf3b432d15b9088ec68b74.png\"\/><\/p>\n<div><figcaption>\u0420\u0438\u0441.1. \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0421\u0423\u0411\u0414<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ac2\/fd3\/818\/ac2fd38182e5fd914eec7f9433b696c1.png\" alt=\"\u0420\u0438\u0441.2. \u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0435\u0441\u0441\u0438\u0438\" title=\"\u0420\u0438\u0441.2. \u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0435\u0441\u0441\u0438\u0438\" width=\"1391\" height=\"812\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ac2\/fd3\/818\/ac2fd38182e5fd914eec7f9433b696c1.png\"\/><\/p>\n<div><figcaption>\u0420\u0438\u0441.2. \u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0435\u0441\u0441\u0438\u0438<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/378\/029\/f58\/378029f586ecc4b472b5fd560db1f858.png\" alt=\"\u0420\u0438\u0441.3. \u0414\u043e\u043b\u0433\u0430\u044f \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0421\u0423\u0411\u0414\" title=\"\u0420\u0438\u0441.3. \u0414\u043e\u043b\u0433\u0430\u044f \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0421\u0423\u0411\u0414\" width=\"1786\" height=\"802\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/378\/029\/f58\/378029f586ecc4b472b5fd560db1f858.png\"\/><\/p>\n<div><figcaption>\u0420\u0438\u0441.3. \u0414\u043e\u043b\u0433\u0430\u044f \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0421\u0423\u0411\u0414<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3a3\/751\/415\/3a3751415db5606298c1e84301b5e1a0.png\" alt=\"\u0420\u0438\u0441.4. \u0414\u043e\u043b\u0433\u0430\u044f \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0430\u044f \u043f\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u0435\u0441\u0441\u0438\u044f\u043c \" title=\"\u0420\u0438\u0441.4. \u0414\u043e\u043b\u0433\u0430\u044f \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0430\u044f \u043f\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u0435\u0441\u0441\u0438\u044f\u043c \" width=\"1793\" height=\"724\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3a3\/751\/415\/3a3751415db5606298c1e84301b5e1a0.png\"\/><\/p>\n<div><figcaption>\u0420\u0438\u0441.4. \u0414\u043e\u043b\u0433\u0430\u044f \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0430\u044f \u043f\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u0435\u0441\u0441\u0438\u044f\u043c <\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/738\/d7a\/f3c\/738d7af3ce57750ef3ff5eb578f47ee9.png\" alt=\"\u0420\u0438\u0441.5. \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0434\u043e\u043b\u0433\u043e\u0439 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0421\u0423\u0411\u0414 \u0438 \u0434\u043e\u043b\u0433\u043e\u0439 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0435\u0441\u0441\u0438\u0439\" title=\"\u0420\u0438\u0441.5. \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0434\u043e\u043b\u0433\u043e\u0439 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0421\u0423\u0411\u0414 \u0438 \u0434\u043e\u043b\u0433\u043e\u0439 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0435\u0441\u0441\u0438\u0439\" width=\"1788\" height=\"900\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/738\/d7a\/f3c\/738d7af3ce57750ef3ff5eb578f47ee9.png\"\/><\/p>\n<div><figcaption>\u0420\u0438\u0441.5. \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0434\u043e\u043b\u0433\u043e\u0439 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0421\u0423\u0411\u0414 \u0438 \u0434\u043e\u043b\u0433\u043e\u0439 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0435\u0441\u0441\u0438\u0439<\/figcaption><\/div>\n<\/figure>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0435\u0441\u0442\u0430<\/h2>\n<p><strong>\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u0430:<\/strong> 17.10.2024  22:22:00<\/p>\n<p><strong>\u0420\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0434\u043e\u0431\u0430\u0432\u043e\u0447\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438:<\/strong><\/p>\n<pre><code class=\"bash\">TIMESTAMP : 17-10-2024 22:20:03\u00a0 : stress_additional : OK : STARTED TIMESTAMP : 17-10-2024 22:20:03\u00a0 : stress_additional : OK :\u00a0\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432: 120<\/code><\/pre>\n<p><strong>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/strong> \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043f\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044e <strong>pgbench<\/strong> \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <strong>220 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432.<\/strong><\/p>\n<h2>\u0418\u0442\u043e\u0433 \u0438 \u043f\u043b\u0430\u043d\u044b<\/h2>\n<ol>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0421\u0423\u0411\u0414 \u043f\u0440\u0438 \u043d\u043e\u0432\u044b\u0445 \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u044f\u0445 <\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <strong>pgbench<\/strong> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043e \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u0432 <a href=\"https:\/\/habr.com\/ru\/articles\/851092\/\" rel=\"noopener noreferrer nofollow\">\u042d\u0442\u044e\u0434: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u043e\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0421\u0423\u0411\u0414 \/ \u0425\u0430\u0431\u0440 (habr.com)<\/a>   (\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430)<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0434\u0430\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u043f\u0440\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/postgrespro.ru\/docs\/enterprise\/16\/pgbench\" rel=\"noopener noreferrer nofollow\"><strong>pgbench<\/strong> <\/a>\u0438 <strong>\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 <\/strong>(<em>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u00a0pgbench\u00a0\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u043e\u0446\u0435\u043d\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0437\u0430\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435) \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c, \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u043c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 (\u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c\u00a0<\/em><code>-f<\/code><em>). \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u00a0\u00ab\u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439\u00bb\u00a0\u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430.<\/em>  )<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/postgrespro.ru\/docs\/enterprise\/16\/pgbench\" rel=\"noopener noreferrer nofollow\"><strong>pgbench<\/strong> <\/a>+ <strong>\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b , <\/strong>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e <strong>\u041f\u0443\u043d\u043a\u0442\u0443 2.<\/strong><\/p>\n<\/li>\n<li>\n<p>\u041f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0421\u0423\u0411\u0414 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u043f\u044b\u0442\u043d\u0443\u044e \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u044e \u0438 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c<\/strong> &#8212; \u0432\u044b\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 , \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u0439 \u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0421\u0423\u0411\u0414 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u0438 \u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0421\u0423\u0411\u0414 \u0432 \u043e\u043f\u044b\u0442\u043d\u0443\u044e \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u044e. <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/851556\/\"> https:\/\/habr.com\/ru\/articles\/851556\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043a \u0421\u0423\u0411\u0414 , \u043f\u0440\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 .<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0421\u0423\u0411\u0414 \u00a0<a href=\"https:\/\/habr.com\/ru\/articles\/850106\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0421\u0423\u0411\u0414 \u2014 \u0440\u0430\u0441\u0447\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0430\u043d\u0430\u043b\u0438\u0437, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \/ \u0425\u0430\u0431\u0440 (habr.com)<\/a>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0421\u0423\u0411\u0414 &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u00a0<a href=\"https:\/\/postgrespro.ru\/docs\/enterprise\/16\/pgbench\" rel=\"noopener noreferrer nofollow\"><strong>pgbench<\/strong><\/a><\/p>\n<h4>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b<\/h4>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 <a href=\"https:\/\/habr.com\/ru\/articles\/851092\/\" rel=\"noopener noreferrer nofollow\">\u042d\u0442\u044e\u0434: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u043e\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0421\u0423\u0411\u0414 \/ \u0425\u0430\u0431\u0440 (habr.com)<\/a>  <\/p>\n<h2>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0442\u0435\u0441\u0442\u0430<\/h2>\n<p><strong>1.\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430 \u0421\u0423\u0411\u0414 <\/strong><\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a pgbench c \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 client:  <\/p>\n<pre><code class=\"bash\">--client=\u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0427\u0438\u0441\u043b\u043e \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0430\u043d\u0441\u043e\u0432 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.\u00a0<\/code><\/pre>\n<p><strong>2.\u041f\u0435\u0440\u0438\u043e\u0434 \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0434\u043e\u043b\u0433\u043e\u0439 \u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0439<\/strong><\/p>\n<p><strong>3.\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430<\/strong><\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f <strong>pgbench <\/strong>\u0441 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u043c \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <strong>client = \u0418\u0442\u0435\u0440\u0430\u0446\u0438\u044f  * 40<\/strong> <\/p>\n<p><strong>4.\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0442\u0435\u0441\u0442\u0430<\/strong><\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <a href=\"https:\/\/e.vyatsu.ru\/pluginfile.php\/462616\/mod_resource\/content\/3\/%D0%A2%D0%B5%D0%BE%D1%80%D0%B5%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9%20%D0%BC%D0%B0%D1%82%D0%B5%D1%80%D0%B8%D0%B0%D0%BB_%D0%BA%D0%BE%D1%80%D1%80%D0%B5%D0%BB%D1%8F%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9%20%D0%B0%D0%BD%D0%B0%D0%BB%D0%B8%D0%B7.pdf?ysclid=m2eanieoxa124041710\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438<\/a> \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0435\u0441\u0441\u0438\u0439 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u043b\u0433\u043e\u0439 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0435\u0439 <strong>R<sub>xy <\/sub>&lt; -0.7<\/strong><\/p>\n<p><strong>5.\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 <\/strong><\/p>\n<p>\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430  <strong>client <\/strong>\u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f  <strong>pgbench.<\/strong>( \u041f\u0443\u043d\u043a\u0442 3.).<\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u0441\u0442\u0430<\/h2>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0411\u0414 \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <\/h3>\n<details class=\"spoiler\">\n<summary>stress_base.create_db.sh<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh # stress_base.create_db.sh # version 8.4 # \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0411\u0414 # \u0418\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0411\u0414   #\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430  function exit_code { ecode=$1 if [[ $ecode != 0 ]]; then ecode=$1 LOG_FILE=$2 ERR_FILE=$3  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE &gt;&gt; $LOG_FILE      exit $ecode fi }  script=$(readlink -f $0) current_path=`dirname $script`  LOG_FILE=$current_path'\/stress_base.create_db.log' ERR_FILE=$current_path'\/stress_base.create_db.err' PROGRESS_FILE=$current_path'\/start_pg_bench.progress'  timestamp_label=$(date \"+%Y%m%d\")'T'$(date \"+%H%M%S\")  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : STARTED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : STARTED '&gt; $LOG_FILE      echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench CREATION IS STARTED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench CREATION IS STARTED ' &gt;&gt; $LOG_FILE     psql -c \"DROP DATABASE IF EXISTS test_pgbench\" 2&gt;&gt;$ERR_FILE exit_code $? $LOG_FILE $ERR_FILE  psql -c \"CREATE DATABASE test_pgbench WITH OWNER = pgpropwr\" 2&gt;&gt;$ERR_FILE exit_code $? $LOG_FILE $ERR_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench HAS BEEN CREATED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : DATABASE test_pgbench HAS BEEN CREATED ' &gt;&gt; $LOG_FILE  ################### # \u041f\u0410\u0420\u0410\u041c\u0415\u0422\u0420\u042b \u0422\u0415\u0421\u0422\u041e\u0412\u041e\u0413\u041e \u0421\u0426\u0415\u041d\u0410\u0420\u0418\u042f let pgbench_clients=`cat $current_path'\/pgbench_clients'` let transactions=`cat $current_path'\/transactions'` ###################  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_clients = '$pgbench_clients echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_clients = '$pgbench_clients &gt;&gt; $LOG_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : transactions = '$transactions echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : transactions = '$transactions &gt;&gt; $LOG_FILE  ######################################################################################################### #\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 pgbench_init_param='--quiet --foreign-keys --scale='\"$pgbench_clients\"' -i test_pgbench'  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_init_param= '$pgbench_init_param echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : pgbench_init_param= '$pgbench_init_param&gt;&gt; $LOG_FILE   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench STARTED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench STARTED' &gt;&gt; $LOG_FILE  pgbench --username=pgpropwr $pgbench_init_param &gt;&gt;$LOG_FILE 2&gt;&gt;$PROGRESS_FILE exit_code $? $LOG_FILE $PROGRESS_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench FINISHED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : OK : INITIALIZATION OF pg_bench FINISHED' &gt;&gt; $LOG_FILE  exit 0 <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <\/h3>\n<details class=\"spoiler\">\n<summary>stress_base.sh<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/bin\/sh # stress_base.sh # version 8.4 # \u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0411\u0414 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e # \u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0411\u0414 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e # VACUUM ANALYZE \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 # \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0421\u0423\u0411\u0414 - \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e # \u0411\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e # touch \/postgres\/scripts\/pgbench\/STOP_PGBENCH  #\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430  function exit_code { ecode=$1 if [[ $ecode != 0 ]]; then ecode=$1 LOG_FILE=$2 ERR_FILE=$3  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : ERROR : Details in '$ERR_FILE &gt;&gt; $LOG_FILE      exit $ecode fi }  script=$(readlink -f $0) current_path=`dirname $script`  LOG_FILE=$current_path'\/stress_base.log'  timestamp_label=$(date \"+%Y%m%d\")'T'$(date \"+%H%M%S\")  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : STARTED ' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : STARTED '&gt; $LOG_FILE  #\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0439 \u0444\u043b\u0430\u0433 if [ -f \/postgres\/scripts\/pgbench\/STOP_PGBENCH ];  then   rm \/postgres\/scripts\/pgbench\/STOP_PGBENCH fi  #\u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 touch \/postgres\/scripts\/stress\/STRESS_NOT_STARTED ;  ################### # \u041f\u0410\u0420\u0410\u041c\u0415\u0422\u0420\u042b \u0422\u0415\u0421\u0422\u041e\u0412\u041e\u0413\u041e \u0421\u0426\u0415\u041d\u0410\u0420\u0418\u042f let pgbench_clients=`cat $current_path'\/pgbench_clients'` let transactions=`cat $current_path'\/transactions'` ###################  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench_clients = '$pgbench_clients echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench_clients = '$pgbench_clients &gt;&gt; $LOG_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : transactions = '$transactions echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : transactions = '$transactions &gt;&gt; $LOG_FILE   RESULT_LOG_FILE=$current_path'\/result.log' echo $(date \"+%d-%m-%Y %H:%M:%S\")' | stress_base | ' &gt; $RESULT_LOG_FILE echo ' timestamp | response time | response time sort | response time long | CPI | Active | CPI MM short  | Active short  | CPI MM short\/Active short correlation | CPI MM long  | Active long  | CPI MM short\/Active long correlation |' &gt;&gt; $RESULT_LOG_FILE   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432: '$pgbench_clients echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432: '$pgbench_clients &gt;&gt; $LOG_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439: '$transactions echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439: '$transactions &gt;&gt; $LOG_FILE   #--jobs=\u043f\u043e\u0442\u043e\u043a\u0438 \u0427\u0438\u0441\u043b\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 pgbench. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445 jobs=`cat \/proc\/cpuinfo|grep processor|wc -l` echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : jobs= '$jobs echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : jobs= '$jobs&gt;&gt; $LOG_FILE    ERR_FILE=$current_path'\/stress_base.err' PROGRESS_FILE=$current_path'\/stress_base.progress' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") &gt; $ERR_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") &gt; $PROGRESS_FILE  pgbench_param='--protocol=extended --report-per-command --jobs='\"$jobs\"' --client='\"$pgbench_clients\"' --transactions='\"$transactions\"' test_pgbench'      echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench_param= '$pgbench_param echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench_param= '$pgbench_param&gt;&gt; $LOG_FILE    let counter=1 while [ 1 = 1 ] do  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : iteration '$counter' - STARTED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : iteration '$counter' - STARTED' &gt;&gt; $LOG_FILE  ###################################################### if [ -f \/postgres\/scripts\/pgbench\/STOP_PGBENCH ];  then   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench has been stopped '   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pgbench has been stopped '&gt;&gt; $LOG_FILE      echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : FINISHED '   echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : FINISHED '&gt;&gt; $LOG_FILE    rm $ERR_FILE      exit 0 fi  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench STARTED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench STARTED' &gt;&gt; $LOG_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench progress stored in file :'$PROGRESS_FILE echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench progress stored in file :'$PROGRESS_FILE  &gt;&gt; $LOG_FILE  pgbench --username=pgpropwr $pgbench_param &gt;&gt;$LOG_FILE 2&gt;&gt;$PROGRESS_FILE exit_code $? $LOG_FILE $PROGRESS_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench FINISHED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : pg_bench FINISHED' &gt;&gt; $LOG_FILE  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : iteration '$counter' - FINISHED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : iteration '$counter' - FINISHED' &gt;&gt; $LOG_FILE let counter=$counter+1 ######################################################  echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : VACUUM ANALYZE : STARTED' echo 'TIMESTAMP : '$(date \"+%d-%m-%Y %H:%M:%S\") ' : stress_base : OK : VACUUM ANALYZE : STARTED' &gt;&gt; $LOG_FILE  psql -d test_pgbench -c 'VACUUM ANALYZE' &gt;&gt;$LOG_FILE 2&gt;&gt;$PROGRESS_FILE exit_code $? $LOG_FILE $PROGRESS_FILE  echo 'TIMESTAMP :<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-435893","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/435893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=435893"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/435893\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=435893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=435893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=435893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}