{"id":38196,"date":"2019-10-31T22:22:13","date_gmt":"2019-10-31T19:22:13","guid":{"rendered":"https:\/\/prohoster.info\/blog\/odin-iz-metodov-polucheniya-profilya-rabochej-nagruzki-i-istorii-ozhidanij-v-postgresql\/"},"modified":"2019-10-31T22:22:13","modified_gmt":"2019-10-31T19:22:13","slug":"odin-iz-metodov-polucheniya-profilya-rabochej-nagruzki-i-istorii-ozhidanij-v-postgresql","status":"publish","type":"post","link":"https:\/\/prohoster.info\/et\/blog\/administrirovanie\/odin-iz-metodov-polucheniya-profilya-rabochej-nagruzki-i-istorii-ozhidanij-v-postgresql","title":{"rendered":"\u00dcks meetodeid t\u00f6\u00f6koormuse profiili ja ootushistooria saamiseks PostgreSQL-is.","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>J\u00e4tkub artikkel &#171;<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/467181\/\">Katse luua ASH-i analoog PostgreSQL-ile <\/a><\/noindex>&#171;.<\/p>\n<p>Artiklis vaadeldakse ja tuuakse v\u00e4lja konkreetsetes p\u00e4ringutes ja n\u00e4idetes, millist kasulikku teavet saab pg_stat_activity ajaloo abil hankida.<\/p>\n<blockquote><p>Hoiatus.<br \/>\nSeoses teema uudsetega ja katseperioodi t\u00e4iendamisega v\u00f5ib artikkel sisaldada vigu. Kritika ja m\u00e4rkused on teretulnud ja oodatud.<\/p><\/blockquote>\n<p><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>Sisendandmed<\/h2>\n<p><\/p>\n<h3>pg_stat_statements ajaloo<\/h3>\n<p>\n<b class=\"spoiler_title\">pg_stat_history<\/b><\/p>\n<pre><code class=\"pgsql\">CREATE TABLE pg_stat_history ( \nid SERIAL, \nsnapshot_timestamp timestamp without time zone, \ndatabase_id integer,\ndbid oid,\nuserid oid,\nqueryid bigint,\nquery text,\ncalls bigint, \ntotal_time double precision, \nmin_time double precision, \nmax_time double precision, \nmean_time double precision,\nstddev_time double precision,\nrows bigint,\nshared_blks_hit bigint, \nshared_blks_read bigint, \nshared_blks_dirtied bigint, \nshared_blks_written bigint, \nlocal_blks_hit bigint, \nlocal_blks_read bigint,\nlocal_blks_dirtied bigint, \nlocal_blks_written bigint, \ntemp_blks_read bigint,\ntemp_blks_written bigint,\nblk_read_time double precision, \nblk_write_time double precision, \nbaseline_id integer );<\/code><\/pre>\n<p>\n Tabel t\u00e4idetakse iga tund, kasutades dblink'i sihtandmebaasi. K\u00f5ige huvitavam ja kasulikum veerg tabelis on muidugi <b>queryid<\/b>.<\/p>\n<h3>pg_stat_activity ajaloo<\/h3>\n<p>\n<b class=\"spoiler_title\">archive_pg_stat_activity<\/b><\/p>\n<pre><code class=\"pgsql\">LOO TABEL archive_pg_stat_activity\n(\n  timepoint timestamp ilma ajav\u00f6\u00f6ndita,\n  datid             oid, \n  datname           name,\n  pid               integer,\n  usesysid          oid,\n  usename           name,\n  application_name  text,\n  client_addr       inet,\n  client_hostname   text,\n  client_port       integer,\n  backend_start     timestamp ilma ajav\u00f6\u00f6ndita,\n  xact_start        timestamp ilma ajav\u00f6\u00f6ndita,\n  query_start       timestamp ilma ajav\u00f6\u00f6ndita,\n  state_change      timestamp ilma ajav\u00f6\u00f6ndita,\n  wait_event_type   text,                     \n  wait_event        text,                   \n  state             text,                  \n  backend_xid       xid,                 \n  backend_xmin      xid,                \n  query             text,               \n  backend_type      text,\n  queryid           bigint\n);<\/code><\/pre>\n<p>\nTabel on tundide kaupa jagatud tabel history_pg_stat_activity (Lisateavet leiate siit \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/467277\/\">pg_stat_statements + pg_stat_activity + loq_query = pg_ash? <\/a><\/noindex> ja siin \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/467181\/\">Proov luua PostgreSQL-i jaoks ASH sarnane.)<\/a><\/noindex><\/p>\n<h2>V\u00e4ljund<\/h2>\n<p><\/p>\n<h3>KLASTRI CPU AEG (S\u00dcSTEEM + KLIENDID)<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\">KOOS \n t KUI\n (\n\tVALI \t\t\n\t\t\tdate_trunc('second', timepoint)\n\tKUST \tactivity_hist.archive_pg_stat_activity aa\n\tKUS \ttimepoint ON TAEVA BETWEEN pg_stat_history_begin+(current_hour_diff * interval '1 hour') JA pg_stat_history_end+(current_hour_diff * interval '1 hour')  JA \n\t\t\t( aa.wait_event_type ON NULL  ) JA\n\t\t\taa.state = 'active'\n )\n VALI count(*) \n INTO cpu_total\n FROM t ;<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre><code class=\"plaintext\">KLASTRI CPU AEG (S\u00dcSTEEM + KLIENDID) : 28:37:46<\/code><\/pre>\n<p><\/p>\n<h3>KLASTRI OOTE AEG<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\">KOOS \n t KUI\n (\n\tVALI \t\t\n\t\t\tdate_trunc('second', timepoint)\n\tKUST \tactivity_hist.archive_pg_stat_activity aa\n\tKUS \ttimepoint ON TAEVA BETWEEN pg_stat_history_begin+(current_hour_diff * interval '1 hour') JA pg_stat_history_end+(current_hour_diff * interval '1 hour')  JA \n\t\t\t( aa.wait_event_type ON NULL  ) JA\n\t\t\taa.state = 'active'\n )\n VALI count(*) \n INTO cpu_total\n FROM t ;<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre><code class=\"plaintext\">KLASTRI OOTE AEG : 30:12:49<\/code><\/pre>\n<p><\/p>\n<h3>Total pg_stat_statements v\u00e4\u00e4rtused<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\"> --KOOS PG_STAT\n  VALI \n    SUM(calls) AS calls, SUM(total_time) AS total_time, SUM(rows) AS rows ,\n\tSUM(shared_blks_hit) AS shared_blks_hit, SUM(shared_blks_read) AS shared_blks_read , \n\tSUM(shared_blks_dirtied) AS shared_blks_dirtied, SUM(shared_blks_written) AS shared_blks_written , \n    SUM(local_blks_hit) AS local_blks_hit , SUM(local_blks_read) AS local_blks_read , \n\tSUM(local_blks_dirtied) AS local_blks_dirtied , SUM(local_blks_written) AS local_blks_written,\n\tSUM(temp_blks_read) AS temp_blks_read, SUM(temp_blks_written) AS temp_blks_written , \n\tSUM(blk_read_time) AS blk_read_time , SUM(blk_write_time) AS blk_write_time\n  INTO \n    pg_total_stat_history_rec\n  KUSTUTA \n    pg_stat_history\n  KUS\n \tsnapshot_timestamp BETWEEN pg_stat_history_begin AND pg_stat_history_end AND \n\tqueryid IS NULL;<\/code><\/pre>\n<p><\/p>\n<h3>SQL DBTIME \u2014 \u00fcldine p\u00e4ringute t\u00e4itmise aeg<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\">dbtime_total = intervall '1 millisekund' * pg_total_stat_history_rec.total_time ;<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre><code class=\"plaintext\">SQL DBTIME : 136:49:36<\/code><\/pre>\n<p><\/p>\n<h3>SQL CPU TIME \u2014 CPU aeg, mis kulus p\u00e4ringute t\u00e4itmiseks<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\">WITH \n t AS\n (\n\tVALI \t\t\n\t\t\tdate_trunc('second', timepoint)\n\tFROM \tactivity_hist.archive_pg_stat_activity aa\n\tKUS \ttimepoint BETWEEN pg_stat_history_begin+(current_hour_diff * intervall '1 tund') AND pg_stat_history_end+(current_hour_diff * intervall '1 tund')  AND \n\t\t\t( aa.wait_event_type IS NULL  ) AND\n\t\t\tbackend_type = 'client backend' AND \n\t\t\taa.state = 'aktive'\n )\n VALI count(*) \n INTO cpu_total\n FROM t ;<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre><code class=\"plaintext\">SQL CPU TIME : 27:40:15<\/code><\/pre>\n<p><\/p>\n<h3>SQL WAITINGS TIME \u2014 \u00fcldine ooteaeg p\u00e4ringute jaoks<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\">WITH \n t AS\n (\n\tSELECT \t\t\n\t\t\tdate_trunc('second', timepoint)\n\tFROM \tactivity_hist.archive_pg_stat_activity aa\n\tWHERE \ttimepoint BETWEEN pg_stat_history_begin+(current_hour_diff * interval '1 hour') AND pg_stat_history_end+(current_hour_diff * interval '1 hour')  AND \n\t\t\t( aa.wait_event_type IS NOT NULL  ) AND\n\t\t\taa.state = 'active' AND \n\t\tbackend_type = 'client backend'\n )\n SELECT count(*) \n INTO waiting_total\n FROM t ;<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre><code class=\"plaintext\">SQL WAITINGUD AEG: 30:04:09<\/code><\/pre>\n<p>\nJ\u00e4rgmised p\u00e4ringud on triviaalset laadi ning ruumi kokkuhoiuks j\u00e4etakse v\u00e4lja teostuse \u00fcksikasjad:<\/p>\n<p><b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre><code class=\"plaintext\">| SQL IOTIME : 19:44:50\n| SQL LOE AEG : 19:44:32\n| SQL KIRJUTA AEG : 00:00:17\n|\n| SQL KUTSED : 12188248\n-------------------------------------------------------------\n| SQL \u00dcHISTE BLOKKIDE LOOD : 7997039120\n| SQL \u00dcHISTE BLOKKIDE L\u00d6\u00d6GID : 8868286092\n| SQL \u00dcHISTE BLOKKIDE L\u00d6\u00d6GID\/LOOD % : 110.89\n| SQL \u00dcHISTE BLOKKIDE SAASTUMINE : 419945\n| SQL \u00dcHISTE BLOKKIDE KIRJUTAMINE : 19857\n|\n| SQL AJUTISTE BLOKKIDE LOOD : 7836169\n| SQL AJUTISTE BLOKKIDE KIRJUTAMINE : 10683938\n<\/code><\/pre>\n<p>\nLiikuge k\u00f5ige huvitavama osa juurde<\/p>\n<h2>WAITINGU STATISTIKA<\/h2>\n<p><\/p>\n<h3>TOP 10 WAITINGUDE KOGU WAITINGU AEGA KLIENDIPROSESSIDE NIMEKIRJA J\u00c4RGI<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\">SELECT \n  wait_event_type , wait_event ,\n  get_system_waiting_duration( wait_event_type , wait_event ,pg_stat_history_begin+(current_hour_diff * interval '1 hour') ,pg_stat_history_end+(current_hour_diff * interval '1 hour') ) as duration \nFROM\n  activity_hist.archive_pg_stat_activity aa\nWHERE \n  timepoint BETWEEN pg_stat_history_begin+(current_hour_diff * interval '1 hour') AND pg_stat_history_end+(current_hour_diff * interval '1 hour') AND backend_type != 'client backend' AND wait_event_type IS NOT NULL \nGROUP BY \n  wait_event_type, wait_event\nORDER BY 3 DESC\nLIMIT 10<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre>+------------------------------------------------------------------------------------\n| TOP 10 OOTUSED P\u00c4EVA KOGU OOTAMISE AJA KOHTA S\u00dcSTEEMIPROSESSID\n+-----+------------------------------+--------------------+--------------------\n|    #|               ootamise_t\u00fc\u00fcp|          ootamise_event|            kestus\n+-----+------------------------------+--------------------+--------------------\n|    1|                      Tegevus| LogicalLauncherMain|            10:43:28\n|    2|                      Tegevus|      AutoVacuumMain|            10:42:49\n|    3|                      Tegevus|       WalWriterMain|            10:28:53\n|    4|                      Tegevus|    CheckpointerMain|            10:23:50\n|    5|                      Tegevus|        BgWriterMain|            09:11:59\n|    6|                      Tegevus|   BgWriterHibernate|            01:37:46\n|    7|                            IO|        BufFileWrite|            00:02:35\n|    8|                        LWLock|      buffer_mapping|            00:01:54\n|    9|                            IO|        DataFileRead|            00:01:23\n|   10|                            IO|            WALWrite|            00:00:59\n+-----+------------------------------+--------------------+--------------------\n<\/pre>\n<p><\/p>\n<h3>TOP 10 WAITINGUDE KOGU WAITINGU AEGA KLIENDIPROSESSIDE NIMEKIRJA J\u00c4RGI<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\">VALI \n  ootamise_t\u00fc\u00fcp , ootamise_event ,\n  get_clients_waiting_duration( ootamise_t\u00fc\u00fcp , ootamise_event , pg_stat_history_begin+(current_hour_diff * interval '1 hour') , pg_stat_history_end+(current_hour_diff * interval '1 hour') ) as kestus\nFROM \n  activity_hist.archive_pg_stat_activity aa\nWHERE \n  timepoint BETWEEN pg_stat_history_begin+(current_hour_diff * interval '1 hour') AND pg_stat_history_end+(current_hour_diff * interval '1 hour') AND backend_type = 'client backend' AND ootamise_t\u00fc\u00fcp IS NOT NULL \nGROUP BY ootamise_t\u00fc\u00fcp, ootamise_event\nORDER BY 3 DESC\nLIMIT 10<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre>+-----+------------------------------+--------------------+--------------------+----------\n|    #|               wait_event_type|          wait_event|            duration|  % dbtime\n+-----+------------------------------+--------------------+--------------------+----------\n|    1|                          Lock|       transactionid|            08:16:47|      6.05\n|    2|                            IO|        DataFileRead|            06:13:41|      4.55\n|    3|                       Timeout|             PgSleep|            02:53:21|      2.11\n|    4|                        LWLock|      buffer_mapping|            00:40:42|       0.5\n|    5|                        LWLock|           buffer_io|            00:17:17|      0.21\n|    6|                            IO|        BufFileWrite|            00:01:34|      0.02\n|    7|                          Lock|               tuple|            00:01:32|      0.02\n|    8|                        Client|          ClientRead|            00:01:19|      0.02\n|    9|                            IO|         BufFileRead|            00:00:37|      0.01\n|   10|                        LWLock|      buffer_content|            00:00:08|         0\n+-----+------------------------------+--------------------+--------------------+----------\n<\/pre>\n<p><\/p>\n<h3>OOTE T\u00dc\u00dcBID KOKKU OOTAMISAEGA, S\u00dcSTEEMIPROSESSIDE KAUPA<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\">VALI \n  wait_event_type ,\n  get_system_waiting_type_duration( wait_event_type , pg_stat_history_begin+(current_hour_diff * interval '1 hour') , pg_stat_history_end+(current_hour_diff * interval '1 hour') ) as duration\nKUST\n  activity_hist.archive_pg_stat_activity aa\nKUS\n  timepoint ON PG_STAT_HISTORY_BEGIN+(current_hour_diff * interval '1 hour') JA PG_STAT_HISTORY_END+(current_hour_diff * interval '1 hour') JA  backend_type != 'client backend' JA wait_event_type ON EI OLE NULL \nGRUPPEERI wait_event_type\nKOHTA 2 LANGA<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre>+-----+------------------------------+--------------------\n|    #|               wait_event_type|            duration\n+-----+------------------------------+--------------------\n|    1|                      Activity|            53:08:45\n|    2|                            IO|            00:06:24\n|    3|                        LWLock|            00:03:02\n+-----+------------------------------+--------------------\n<\/pre>\n<p><\/p>\n<h3> KLIENDI PROTSESSIDE OOTAMISAEG T\u00fc\u00fcbid<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\">VALI \n  wait_event_type ,\n  get_clients_waiting_type_duration( wait_event_type , pg_stat_history_begin+(current_hour_diff * interval '1 hour') , pg_stat_history_end+(current_hour_diff * interval '1 hour') ) as duration\nFROM\n  activity_hist.archive_pg_stat_activity aa\nWHERE \n  timepoint BETWEEN pg_stat_history_begin+(current_hour_diff * interval '1 hour') AND pg_stat_history_end+(current_hour_diff * interval '1 hour') AND backend_type = 'client backend' AND wait_event_type IS NOT NULL \nGROUP BY wait_event_type\nORDER BY 2 DESC<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre>+-----+------------------------------+--------------------+--------------------\n|    #|               wait_event_type|            duration|            % dbtime\n+-----+------------------------------+--------------------+--------------------\n|    1|                          Lock|            08:18:19|                6.07\n|    2|                            IO|            06:16:01|                4.58\n|    3|                       Timeout|            02:53:21|                2.11\n|    4|                        LWLock|            00:58:12|                0.71\n|    5|                        Client|            00:01:19|                0.02\n|    6|                           IPC|            00:00:04|                   0\n+-----+------------------------------+--------------------+--------------------\n<\/pre>\n<p>\nOotamisi kestused, s\u00fcsteemsete protsesside ja eraldi p\u00e4ringute jaoks.<\/p>\n<h3>OOTAMISED S\u00dcSTEEMSETELE PROTSESSIDELE<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\">VALI \n  backend_type , datname , wait_event_type , wait_event , get_backend_type_waiting_duration( backend_type , wait_event_type , wait_event , pg_stat_history_begin+(current_hour_diff * interval '1 hour') , pg_stat_history_end+(current_hour_diff * interval '1 hour') ) AS kestus \nKUST \n  activity_hist.archive_pg_stat_activity aa\nKUS \n  timepoint KESKUSEL pg_stat_history_begin+(current_hour_diff * interval '1 hour') JA pg_stat_history_end+(current_hour_diff * interval '1 hour') JA backend_type != 'client backend' JA wait_event_type EI OLE NULL \nGRUPPEERI backend_type , datname , wait_event_type , wait_event\nKORDA 5 KAHO<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre>+-----+-----------------------------+----------+--------------------+----------------------+--------------------\n|    #|                 backend_type|    dbname|     wait_event_type|            wait_event|            duration\n+-----+-----------------------------+----------+--------------------+----------------------+--------------------\n|    1| loogiline replikeerimise k\u00e4ivitaja|          |            Tegevus|   LogicalLauncherMain|            10:43:28\n|    2|          autovacuum'i k\u00e4ivitaja|          |            Tegevus|        AutoVacuumMain|            10:42:49\n|    3|                    walwriter|          |            Tegevus|         WalWriterMain|            10:28:53\n|    4|                 checkpointer|          |            Tegevus|      CheckpointerMain|            10:23:50\n|    5|            taustakirjutaja|          |            Tegevus|          BgWriterMain|            09:11:59\n|    6|            taustakirjutaja|          |            Tegevus|     BgWriterHibernate|            01:37:46\n|    7|              parallelt\u00f6\u00f6line|      tdb1|                  IO|          BufFileWrite|            00:02:35\n|    8|              parallelt\u00f6\u00f6line|      tdb1|              LWLock|        buffer_mapping|            00:01:41\n|    9|              parallelt\u00f6\u00f6line|      tdb1|                  IO|          DataFileRead|            00:01:22\n|   10|              parallelt\u00f6\u00f6line|      tdb1|                  IO|           BufFileRead|            00:00:59\n|   11|                    walwriter|          |                  IO|              WALWrite|            00:00:57\n|   12|              parallelt\u00f6\u00f6line|      tdb1|              LWLock|             buffer_io|            00:00:47\n|   13|            autovacuum'i t\u00f6\u00f6taja|      tdb1|              LWLock|        buffer_mapping|            00:00:13\n|   14|            taustakirjutaja|          |                  IO|         DataFileWrite|            00:00:12\n|   15|                 checkpointer|          |                  IO|         DataFileWrite|            00:00:11\n|   16|                    walwriter|          |              LWLock|          WALWriteLock|            00:00:09\n|   17|                 checkpointer|          |              LWLock|          WALWriteLock|            00:00:06\n|   18|            taustakirjutaja|          |              LWLock|          WALWriteLock|            00:00:06\n|   19|                    walwriter|          |                  IO|          WALInitWrite|            00:00:02\n|   20|            autovacuum'i t\u00f6\u00f6taja|      tdb1|              LWLock|          WALWriteLock|            00:00:02\n|   21|                    walwriter|          |                  IO|           WALInitSync|            00:00:02\n|   22|            autovacuum'i t\u00f6\u00f6taja|      tdb1|                  IO|          DataFileRead|            00:00:01\n|   23|                 checkpointer|          |                  IO| ControlFileSyncUpdate|            00:00:01\n|   24|            taustakirjutaja|          |                  IO|              WALWrite|            00:00:01\n|   25|            taustakirjutaja|          |                  IO|         DataFileFlush|            00:00:01\n|   26|                 checkpointer|          |                  IO|         SLRUFlushSync|            00:00:01\n|   27|            autovacuum'i t\u00f6\u00f6taja|      tdb1|                  IO|              WALWrite|            00:00:01\n|   28|                 checkpointer|          |                  IO|          DataFileSync|            00:00:01\n+-----+-----------------------------+----------+--------------------+----------------------+--------------------<\/pre>\n<p><\/p>\n<h3>WAITINGS FOR SQL \u2014 ootused eraldi p\u00e4ringute jaoks queryid j\u00e4rgi<\/h3>\n<p>\n<b class=\"spoiler_title\">P\u00e4ring<\/b><\/p>\n<pre><code class=\"pgsql\">SELECT \nqueryid , datname , wait_event_type , wait_event , get_query_waiting_duration( queryid ,  wait_event_type , wait_event , pg_stat_history_begin+(current_hour_diff * interval '1 hour') , pg_stat_history_end+(current_hour_diff * interval '1 hour') ) as duration \nFROM \n  activity_hist.archive_pg_stat_activity aa\nWHERE \n  timepoint BETWEEN pg_stat_history_begin+(current_hour_diff * interval '1 hour') AND pg_stat_history_end+(current_hour_diff * interval '1 hour') AND backend_type = 'client backend' AND wait_event_type IS NOT NULL AND queryid IS NOT NULL \nGROUP BY queryid , datname , wait_event_type , wait_event\nORDER BY 1 , 5 DESC <\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">N\u00e4ide<\/b><\/p>\n<pre>+-----+-------------------------+----------+--------------------+--------------------+--------------------+--------------------\n|    #|                  queryid|    dbname|     wait_event_type|          wait_event|            waitings|               total\n|     |                         |          |                    |                    |            duration|            duration\n+-----+-------------------------+----------+--------------------+--------------------+--------------------+--------------------\n|    1|     -8247416849404883188|      tdb1|              Client|          ClientRead|            00:00:02|\n|    2|     -6572922443698419129|      tdb1|              Client|          ClientRead|            00:00:05|\n|    3|     -6572922443698419129|      tdb1|                  IO|        DataFileRead|            00:00:01|\n|    4|     -5917408132400665328|      tdb1|              Client|          ClientRead|            00:00:04|\n|    5|     -4091009262735781873|      tdb1|              Client|          ClientRead|            00:00:03|\n|    6|     -1473395109729441239|      tdb1|              Client|          ClientRead|            00:00:01|\n|    7|        28942442626229688|      tdb1|                  IO|        BufFileWrite|            00:01:34|            00:46:06\n|    8|        28942442626229688|      tdb1|              LWLock|      buffer_mapping|            00:01:05|            00:46:06\n|    9|        28942442626229688|      tdb1|                  IO|        DataFileRead|            00:00:44|            00:46:06\n|   10|        28942442626229688|      tdb1|                  IO|         BufFileRead|            00:00:37|            00:46:06\n|   11|        28942442626229688|      tdb1|              LWLock|           buffer_io|            00:00:35|            00:46:06\n|   12|        28942442626229688|      tdb1|              Client|          ClientRead|            00:00:05|            00:46:06\n|   13|        28942442626229688|      tdb1|                 IPC| MessageQueueReceive|            00:00:03|            00:46:06\n|   14|        28942442626229688|      tdb1|                 IPC|    BgWorkerShutdown|            00:00:01|            00:46:06\n|   15|       389015618226997618|      tdb1|                Lock|       transactionid|            03:55:09|            04:14:15\n|   16|       389015618226997618|      tdb1|                  IO|        DataFileRead|            03:23:09|            04:14:15\n|   17|       389015618226997618|      tdb1|              LWLock|      buffer_mapping|            00:12:09|            04:14:15\n|   18|       389015618226997618|      tdb1|              LWLock|           buffer_io|            00:10:18|            04:14:15\n|   19|       389015618226997618|      tdb1|                Lock|               tuple|            00:00:35|            04:14:15\n|   20|       389015618226997618|      tdb1|              LWLock|        WALWriteLock|            00:00:02|            04:14:15\n|   21|       389015618226997618|      tdb1|                  IO|       DataFileWrite|            00:00:01|            04:14:15\n|   22|       389015618226997618|      tdb1|              LWLock|        SyncScanLock|            00:00:01|            04:14:15\n|   23|       389015618226997618|      tdb1|              Client|          ClientRead|            00:00:01|            04:14:15\n|   24|       734234407411547467|      tdb1|              Client|          ClientRead|            00:00:11|\n|   25|       734234407411547467|      tdb1|              LWLock|      buffer_mapping|            00:00:05|\n|   26|       734234407411547467|      tdb1|                  IO|        DataFileRead|            00:00:02|\n|   27|      1237430309438971376|      tdb1|              LWLock|      buffer_mapping|            00:02:18|            02:45:40\n|   28|      1237430309438971376|      tdb1|                  IO|        DataFileRead|            00:00:27|            02:45:40\n|   29|      1237430309438971376|      tdb1|              Client|          ClientRead|            00:00:02|            02:45:40\n|   30|      2404820632950544954|      tdb1|              Client|          ClientRead|            00:00:01|\n|   31|      2515308626622579467|      tdb1|              Client|          ClientRead|            00:00:02|\n|   32|      4710212362688288619|      tdb1|              LWLock|      buffer_mapping|            00:03:08|            02:18:21\n|   33|      4710212362688288619|      tdb1|                  IO|        DataFileRead|            00:00:22|            02:18:21\n|   34|      4710212362688288619|      tdb1|              Client|          ClientRead|            00:00:06|            02:18:21\n|   35|      4710212362688288619|      tdb1|              LWLock|           buffer_io|            00:00:02|            02:18:21\n|   36|      9150846928388977274|      tdb1|                  IO|        DataFileRead|            00:01:19|\n|   37|      9150846928388977274|      tdb1|              LWLock|      buffer_mapping|            00:00:34|\n|   38|      9150846928388977274|      tdb1|              Client|          ClientRead|            00:00:10|\n|   39|      9150846928388977274|      tdb1|              LWLock|           buffer_io|            00:00:01|\n+-----+-------------------------+----------+--------------------+--------------------+--------------------+--------------------<\/pre>\n<p><\/p>\n<h3>KLIENDI SQL STATISTIKA \u2014 PARIMAD p\u00e4ringud<\/h3>\n<p>\nP\u00e4ringud, et need uuesti saada, on taas triviaalne ja ruumi kokkuhoiu nimel ei ole need siin toodud. <\/p>\n<p><b class=\"spoiler_title\">N\u00e4ited<\/b><\/p>\n<pre>+------------------------------------------------------------------------------------\n| KLIENTI SQL j\u00e4rjestatud kulumise aja kohaselt\n+--------------------+----------+----------+----------+----------+----------+--------------------\n|        kulumise aeg|     kutsed|  % dbajas|     % CPU|      % IO|    andmebaas|             p\u00e4ringu id\n+--------------------+----------+----------+----------+----------+----------+--------------------\n|            04:14:15|        19|       3.1|     10.83|     11.52|      tdb1|  389015618226997618\n|            02:45:40|       746|      2.02|      4.23|      0.08|      tdb1| 1237430309438971376\n|            02:18:21|       749|      1.69|      3.39|       0.1|      tdb1| 4710212362688288619\n|            00:46:06|       375|      0.56|      0.94|      0.41|      tdb1|   28942442626229688\n+--------------------+----------+----------+----------+----------+----------+--------------------\n| KLIENTI SQL j\u00e4rjestatud CPU aja kohaselt\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n|            CPU aeg|     kutsed|  % dbajas|kokku_aeg|     % CPU|      % IO|    andmebaas|             p\u00e4ringu id\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n|            02:59:49|        19|       3.1|  04:14:15|     10.83|     11.52|      tdb1|  389015618226997618\n|            01:10:12|       746|      2.02|  02:45:40|      4.23|      0.08|      tdb1| 1237430309438971376\n|            00:56:15|       749|      1.69|  02:18:21|      3.39|       0.1|      tdb1| 4710212362688288619\n|            00:15:35|       375|      0.56|  00:46:06|      0.94|      0.41|      tdb1|   28942442626229688\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n| KLIENTI SQL j\u00e4rjestatud Kasutaja I\/O ooteaja kohaselt\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n|        IO ooteaeg|     kutsed|  % dbajas|kokku_aeg|     % CPU|      % IO|    andmebaas|             p\u00e4ringu id\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n|            03:23:10|        19|       3.1|  04:14:15|     10.83|     11.52|      tdb1|  389015618226997618\n|            00:02:54|       375|      0.56|  00:46:06|      0.94|      0.41|      tdb1|   28942442626229688\n|            00:00:27|       746|      2.02|  02:45:40|      4.23|      0.08|      tdb1| 1237430309438971376\n|            00:00:22|       749|      1.69|  02:18:21|      3.39|       0.1|      tdb1| 4710212362688288619\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n| KLIENTI SQL j\u00e4rjestatud Jaga Buffers Lugemiste kohaselt\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n|       buffers lugemised|     kutsed|  % dbajas|kokku_aeg|     % CPU|      % IO|    andmebaas|             p\u00e4ringu id\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n|          1056388566|        19|       3.1|  04:14:15|     10.83|     11.52|      tdb1|  389015618226997618\n|            11709251|       375|      0.56|  00:46:06|      0.94|      0.41|      tdb1|   28942442626229688\n|             3439004|       746|      2.02|  02:45:40|      4.23|      0.08|      tdb1| 1237430309438971376\n|             3373330|       749|      1.69|  02:18:21|      3.39|       0.1|      tdb1| 4710212362688288619\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n| KLIENTI SQL j\u00e4rjestatud Plaadi Lugemise Aja kohaselt\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n|           lugemise aeg|     kutsed|  % dbajas|kokku_aeg|     % CPU|      % IO|    andmebaas|             p\u00e4ringu id\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n|            02:16:30|        19|       3.1|  04:14:15|     10.83|     11.52|      tdb1|  389015618226997618\n|            00:04:50|       375|      0.56|  00:46:06|      0.94|      0.41|      tdb1|   28942442626229688\n|            00:01:10|       749|      1.69|  02:18:21|      3.39|       0.1|      tdb1| 4710212362688288619\n|            00:00:57|       746|      2.02|  02:45:40|      4.23|      0.08|      tdb1| 1237430309438971376\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n| KLIENTI SQL j\u00e4rjestatud T\u00e4itmiste kohaselt\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n|               kutsed|      read|  % dbajas|kokku_aeg|     % CPU|      % IO|    andmebaas|             p\u00e4ringu id\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------\n|                 749|       749|      1.69|  02:18:21|      3.39|       0.1|      tdb1| 4710212362688288619\n|                 746|       746|      2.02|  02:45:40|      4.23|      0.08|      tdb1| 1237430309438971376\n|                 375|         0|      0.56|  00:46:06|      0.94|      0.41|      tdb1|   28942442626229688\n|                  19|        19|       3.1|  04:14:15|     10.83|     11.52|      tdb1|  389015618226997618\n+--------------------+----------+----------+----------+----------+----------+----------+--------------------<\/pre>\n<p><\/p>\n<h2>Kokkuv\u00f5te<\/h2>\n<p>\nKasutades esitatud p\u00e4ringuid ja saadud aruandeid, on v\u00f5imalik saada p\u00f5hjalikum \u00fclevaade anal\u00fc\u00fcsimiseks ja j\u00f5udluse halvenemise probleemide lahendamiseks \u00fcksikute p\u00e4ringute ja kogu klastriga seoses.<\/p>\n<h2>Areng<\/h2>\n<p>\nPraegused arendusplaanid on j\u00e4rgmised:<\/p>\n<ul>\n<li>T\u00e4iendame aruannet lukustuste ajalooga. P\u00e4ringud on testimisel ja esitatakse varsti.<\/li>\n<li>Kasutada TimescaleDB laiendust pg_stat_activity ja pg_locks ajaloo s\u00e4ilitamiseks.<\/li>\n<li>Valmistada ette pakett lahenduste jaoks GitHubis, et massiliselt juurutada tootmisandmebaasidesse.<\/li>\n<\/ul>\n<p>\nJ\u00e4tkub\u2026<br \/>\n<br \/>Allikas: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/467575\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 &#171;\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433 ASH \u0434\u043b\u044f PostgreSQL &#171;. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u2014 \u043a\u0430\u043a\u0443\u044e \u0436\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f pg_stat_activity. \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043d\u043e\u0432\u0438\u0437\u043d\u043e\u0439 \u0442\u0435\u043c\u044b \u0438 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u0442\u0430\u0442\u044c\u044f \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438. \u041a\u0440\u0438\u0442\u0438\u043a\u0430 \u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0438 \u043e\u0436\u0438\u0434\u0430\u044e\u0442\u0441\u044f. \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-38196","post","type-post","status-publish","format-standard","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 &quot;\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433 ASH \u0434\u043b\u044f PostgreSQL &quot;. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u2014 \u043a\u0430\u043a\u0443\u044e \u0436\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f pg_stat_activity. \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043d\u043e\u0432\u0438\u0437\u043d\u043e\u0439 \u0442\u0435\u043c\u044b \u0438 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u0442\u0430\u0442\u044c\u044f \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438. \u041a\u0440\u0438\u0442\u0438\u043a\u0430 \u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0438 \u043e\u0436\u0438\u0434\u0430\u044e\u0442\u0441\u044f.\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0418\u0441\u0442\u043e\u0440\u0438\u044f\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/et\/blog\/administrirovanie\/odin-iz-metodov-polucheniya-profilya-rabochej-nagruzki-i-istorii-ozhidanij-v-postgresql\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"et_EE\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041e\u0434\u0438\u043d \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0439 \u0432 PostgreSQL | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 &quot;\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433 ASH \u0434\u043b\u044f PostgreSQL &quot;. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u2014 \u043a\u0430\u043a\u0443\u044e \u0436\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f pg_stat_activity. \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043d\u043e\u0432\u0438\u0437\u043d\u043e\u0439 \u0442\u0435\u043c\u044b \u0438 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u0442\u0430\u0442\u044c\u044f \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438. \u041a\u0440\u0438\u0442\u0438\u043a\u0430 \u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0438 \u043e\u0436\u0438\u0434\u0430\u044e\u0442\u0441\u044f.\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0418\u0441\u0442\u043e\u0440\u0438\u044f\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/et\/blog\/administrirovanie\/odin-iz-metodov-polucheniya-profilya-rabochej-nagruzki-i-istorii-ozhidanij-v-postgresql\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T19:22:13+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T19:22:13+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47\u00dcks meetod t\u00f6\u00f6koormuse profiili ja ootushistoria saamiseks PostgreSQL-is | ProHoster","description":"Artikli \"P\u00fc\u00fcd luua PostgreSQLi ASH'i analoog\" j\u00e4tk. Artiklis k\u00e4sitletakse ja n\u00e4idatakse konkreetsete p\u00e4ringute ja n\u00e4idete kaudu, millist kasulikku teavet saab pg_stat_activity ajaloo toel. Hoiatamine. Seoses teema uudsuse ja testimisperioodi l\u00f5petamisega v\u00f5ib artikkel sisaldada vigu. Kriitika ja m\u00e4rkused on teretulnud ja oodatud. Sisendandmed Ajalugu","canonical_url":"https:\/\/prohoster.info\/et\/blog\/administrirovanie\/odin-iz-metodov-polucheniya-profilya-rabochej-nagruzki-i-istorii-ozhidanij-v-postgresql","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"et_EE","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041e\u0434\u0438\u043d \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0439 \u0432 PostgreSQL | ProHoster","og:description":"\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 &quot;\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433 ASH \u0434\u043b\u044f PostgreSQL &quot;. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u2014 \u043a\u0430\u043a\u0443\u044e \u0436\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f pg_stat_activity. \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043d\u043e\u0432\u0438\u0437\u043d\u043e\u0439 \u0442\u0435\u043c\u044b \u0438 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u0442\u0430\u0442\u044c\u044f \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438. \u041a\u0440\u0438\u0442\u0438\u043a\u0430 \u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0438 \u043e\u0436\u0438\u0434\u0430\u044e\u0442\u0441\u044f.\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0418\u0441\u0442\u043e\u0440\u0438\u044f","og:url":"https:\/\/prohoster.info\/et\/blog\/administrirovanie\/odin-iz-metodov-polucheniya-profilya-rabochej-nagruzki-i-istorii-ozhidanij-v-postgresql","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T19:22:13+00:00","article:modified_time":"2019-10-31T19:22:13+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"38196","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-23 20:52:50","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 01:13:23","updated":"2026-01-23 20:52:50"},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/posts\/38196","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/comments?post=38196"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/posts\/38196\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/media?parent=38196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/categories?post=38196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/et\/wp-json\/wp\/v2\/tags?post=38196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}