{"id":31905,"date":"2019-10-31T21:43:52","date_gmt":"2019-10-31T18:43:52","guid":{"rendered":"https:\/\/prohoster.info\/blog\/happy-party-ili-para-strok-vospominanij-o-znakomstve-s-sektsionirovaniem-v-postgresql10\/"},"modified":"2019-10-31T21:43:52","modified_gmt":"2019-10-31T18:43:52","slug":"happy-party-ili-para-strok-vospominanij-o-znakomstve-s-sektsionirovaniem-v-postgresql10","status":"publish","type":"post","link":"https:\/\/prohoster.info\/pt\/blog\/administrirovanie\/happy-party-ili-para-strok-vospominanij-o-znakomstve-s-sektsionirovaniem-v-postgresql10","title":{"rendered":"Happy Party ou algumas linhas de mem\u00f3rias sobre a introdu\u00e7\u00e3o ao particionamento no PostgreSQL10","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<h4>Pref\u00e1cio ou como surgiu a ideia de particionamento<\/h4>\n<p>\nO in\u00edcio da hist\u00f3ria aqui: <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/icl_services\/blog\/446314\/\">Voc\u00ea se lembra de como tudo come\u00e7ou? Tudo era a primeira vez e novamente.<\/a><\/noindex> Depois que quase todos os recursos para otimiza\u00e7\u00e3o da consulta, naquele momento, foram esgotados, surgiu a pergunta \u2013 e agora, o que fazer? Assim surgiu a ideia do particionamento. <\/p>\n<p><img decoding=\"async\" alt=\"Happy Party ou algumas linhas de mem\u00f3rias sobre a introdu\u00e7\u00e3o ao particionamento no PostgreSQL10\" src=\"\/wp-content\/uploads\/2019\/04\/ef30e00aac34e9522e1d3e1875aa93bf.jpeg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n<b>Uma digress\u00e3o l\u00edrica:<\/b><br \/>\n<i>Exatamente 'naquele momento', por isso <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/icl_services\/blog\/446314\/#comment_19973236\">como se revelou, havia reservas n\u00e3o utilizadas para otimiza\u00e7\u00e3o<\/a><\/noindex>. Obrigado <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/users\/asmm\/\" class=\"user_link\">asmm<\/a><\/noindex> e Habr!<\/i><\/p>\n<p>Ent\u00e3o, como mais podemos deixar o cliente aparentemente feliz, enquanto aprimoramos nossas pr\u00f3prias habilidades? <\/p>\n<p><b>Se quisermos simplificar ao m\u00e1ximo<\/b>, ent\u00e3o, as maneiras de melhorar algo radicalmente na performance do banco de dados s\u00e3o apenas duas:<br \/>\n1) Caminho extensivo \u2014 aumentamos recursos, modificamos a configura\u00e7\u00e3o;<br \/>\n2) Caminho intensivo \u2014 otimizamos as consultas<\/p>\n<p>Como j\u00e1 mencionei, naquele momento n\u00e3o estava claro o que mais mudar na consulta para acelerar, foi escolhido o caminho \u2014 <b>mudan\u00e7as no design das tabelas.<\/b><\/p>\n<p><b>Ent\u00e3o \u2014 surge a quest\u00e3o principal \u2014 o que e como vamos mudar? <\/b><br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>Condi\u00e7\u00f5es iniciais<\/h2>\n<p>\nPrimeiro, temos este ERD (mostrado de forma simplificada):<br \/>\n<img decoding=\"async\" alt=\"Happy Party ou algumas linhas de mem\u00f3rias sobre a introdu\u00e7\u00e3o ao particionamento no PostgreSQL10\" src=\"\/wp-content\/uploads\/2019\/04\/de270774e7dd99b060cc200ba5012075.jpeg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nPrincipais caracter\u00edsticas:<\/p>\n<ol>\n<li> rela\u00e7\u00f5es 'muitos para muitos'<\/li>\n<li> a tabela j\u00e1 tem uma chave potencial de particionamento <\/li>\n<\/ol>\n<p>Consulta original:<\/p>\n<pre><code class=\"plaintext\">SELECT\n            p.\"PARAMETER_ID\" as parameter_id,\n            pc.\"PC_NAME\" AS pc_name,\n            pc.\"CUSTOMER_PARTNUMBER\" AS customer_partnumber,\n            w.\"LASERMARK\" AS lasermark,\n            w.\"LOTID\" AS lotid,\n            w.\"REPORTED_VALUE\" AS reported_value,\n            w.\"LOWER_SPEC_LIMIT\" AS lower_spec_limit,\n            w.\"UPPER_SPEC_LIMIT\" AS upper_spec_limit,\n            p.\"TYPE_CALCUL\" AS type_calcul,\n            s.\"SHIPMENT_NAME\" AS shipment_name,\n            s.\"SHIPMENT_DATE\" AS shipment_date,\n            extract(year from s.\"SHIPMENT_DATE\") AS year,\n            extract(month from s.\"SHIPMENT_DATE\") as month,\n            s.\"REPORT_NAME\" AS report_name,\n            p.\"SPARAM_NAME\" AS SPARAM_name,\n            p.\"CUSTOMERPARAM_NAME\" AS customerparam_name\n        FROM data w INNER JOIN shipment s ON s.\"SHIPMENT_ID\" = w.\"SHIPMENT_ID\"\n             INNER JOIN parameters p ON p.\"PARAMETER_ID\" = w.\"PARAMETER_ID\"\n             INNER JOIN shipment_pc sp ON s.\"SHIPMENT_ID\" = sp.\"SHIPMENT_ID\"\n             INNER JOIN pc pc ON pc.\"PC_ID\" = sp.\"PC_ID\"\n             INNER JOIN ( SELECT w2.\"LASERMARK\" , MAX(s2.\"SHIPMENT_DATE\") AS \"SHIPMENT_DATE\"\n                          FROM shipment s2 INNER JOIN data w2 ON s2.\"SHIPMENT_ID\" = w2.\"SHIPMENT_ID\" \n                          GROUP BY w2.\"LASERMARK\"\n                         ) md ON md.\"SHIPMENT_DATE\" = s.\"SHIPMENT_DATE\" AND md.\"LASERMARK\" = w.\"LASERMARK\"\n        WHERE \n             s.\"SHIPMENT_DATE\" &gt;= '2018-07-01' AND s.\"SHIPMENT_DATE\" &lt;= &#039;2018-09-30&#039; ;\n<\/code><\/pre>\n<p>\n<b>Resultados da execu\u00e7\u00e3o na base de dados de teste:<\/b><br \/>\n<b>Custo <\/b>: 502 997.55<br \/>\n<b>Tempo de execu\u00e7\u00e3o<\/b>: 505 segundos.<\/p>\n<p>O que vemos? Uma consulta comum, por recorte temporal. <br \/>\nFazemos uma suposi\u00e7\u00e3o l\u00f3gica simples: se h\u00e1 uma amostra de um intervalo de tempo, isso nos ajuda? Certo \u2014 parti\u00e7\u00e3o.<\/p>\n<h2>O que particionar?<\/h2>\n<p>\n\u00c0 primeira vista, a escolha \u00e9 \u00f3bvia \u2014 parti\u00e7\u00e3o declarativa da tabela \"shipment\" pela chave \"SHIPMENT_DATE\" (<i>adiantando um pouco \u2014 no final, em produ\u00e7\u00e3o, n\u00e3o deu bem assim<\/i>). <\/p>\n<h2>Como particionar?<\/h2>\n<p>\nEssa pergunta tamb\u00e9m n\u00e3o \u00e9 muito dif\u00edcil. Felizmente, no PostgreSQL 10, agora h\u00e1 um mecanismo de parti\u00e7\u00e3o acess\u00edvel. <br \/>\nEnt\u00e3o: <\/p>\n<ol>\n<li> Salvamos o dump da tabela original \u2014 <i>pg_dump source_table<\/i><\/li>\n<li> Deletamos a tabela original \u2014 <i>drop table source_table<\/i><\/li>\n<li>Criamos a tabela pai com parti\u00e7\u00e3o por intervalo \u2014 <i>create table source_table<\/i><\/li>\n<li> Criamos as se\u00e7\u00f5es \u2014 <i>create table source_table, create index<\/i><\/li>\n<li> Importamos o dump criado na etapa 1 \u2014 <i>pg_restore<\/i><\/li>\n<\/ol>\n<p><\/p>\n<h2>Scripts para parti\u00e7\u00e3o <\/h2>\n<p>\nPara simplificar e facilitar, as etapas 2, 3 e 4 foram unidas em um \u00fanico script. <\/p>\n<p>Ent\u00e3o: <br \/>\n<b class=\"spoiler_title\">Salvamos o dump da tabela original<\/b><\/p>\n<pre><code class=\"plaintext\">pg_dump postgres --file=\\\/dump\\\/shipment.dmp --format=c --table=shipment --verbose &gt; \\\/dump\\\/shipment.log 2&gt;&amp;1<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">Deletamos a tabela original + Criamos a tabela pai com parti\u00e7\u00e3o por intervalo + Criamos as se\u00e7\u00f5es<\/b><\/p>\n<pre><code class=\"plaintext\">--create_partition_shipment.sql\ndo language plpgsql $$\ndeclare \nrec_shipment_date RECORD ;\npartition_name varchar;\nindex_name varchar;\ncurrent_year varchar ;\ncurrent_month varchar ;\nbegin_year varchar ;\nbegin_month varchar ;\nnext_year varchar ;\nnext_month varchar ;\nfirst_flag boolean ;\ni integer ;\nbegin\n  RAISE NOTICE 'CRIAR TABELA TEMPOR\u00c1RIA PARA DATA_DE_ENVIO';\n  CREATE TEMP TABLE tmp_shipment_date as select distinct \"SHIPMENT_DATE\" from shipment order by \"SHIPMENT_DATE\" ;\n\n  RAISE NOTICE 'DROPAR TABELA shipment';\n  drop table shipment cascade ;\n  \n  CREATE TABLE public.shipment\n  (\n    \"SHIPMENT_ID\" integer NOT NULL DEFAULT nextval('shipment_shipment_id_seq'::regclass),\n    \"SHIPMENT_NAME\" character varying(30) COLLATE pg_catalog.\"default\",\n    \"SHIPMENT_DATE\" timestamp without time zone,\n    \"REPORT_NAME\" character varying(40) COLLATE pg_catalog.\"default\"\n  )\n  PARTITION BY RANGE (\"SHIPMENT_DATE\")\n  WITH (\n      OIDS = FALSE\n  )\n  TABLESPACE pg_default;\n\n  RAISE NOTICE 'CRIAR PARTI\u00c7\u00d5ES PARA A TABELA shipment';\n\n  current_year:='0';\n  current_month:='0';\n\n  begin_year := '0' ;\n  begin_month := '0'  ;\n  next_year := '0' ;\n  next_month := '0'  ;\n\n  FOR rec_shipment_date IN SELECT * FROM tmp_shipment_date LOOP\n      \n      RAISE NOTICE 'SHIPMENT_DATE=%',rec_shipment_date.\"SHIPMENT_DATE\";\n      \n      current_year := date_part('year' ,rec_shipment_date.\"SHIPMENT_DATE\");\n      current_month := date_part('month' ,rec_shipment_date.\"SHIPMENT_DATE\") ; \n\n      IF to_number(current_month,'99') = to_date( begin_year||'.'||begin_month, 'YYYY.MM') AND \n         to_date( current_year||'.'||current_month, 'YYYY.MM') &lt; to_date( next_year||&#039;.&#039;||next_month, &#039;YYYY.MM&#039;) AND \n         NOT first_flag \n      THEN\n         CONTINUE ; \n      ELSE\n       --NOVOS limites apenas para a segunda vez e depois \n       begin_year := current_year ;\n       begin_month := current_month ;   \n   \n        IF current_month = &#039;12&#039; THEN\n          next_year := date_part(&#039;year&#039; ,rec_shipment_date.&quot;SHIPMENT_DATE&quot; + interval &#039;1 year&#039;) ;\n        ELSE\n          next_year := current_year ;\n        END IF;\n     \n       next_month := date_part(&#039;month&#039; ,rec_shipment_date.&quot;SHIPMENT_DATE&quot; + interval &#039;1 month&#039;) ;\n\n      END IF;      \n\n      partition_name := &#039;shipment_shipment_date_&#039;||begin_year||&#039;-&#039;||begin_month||&#039;-01-&#039;|| next_year||&#039;-&#039;||next_month||&#039;-01&#039;  ;\n \n     EXECUTE format(&#039;CREATE TABLE &#039; || quote_ident(partition_name) || &#039; PARTITION OF shipment FOR VALUES FROM ( %L ) TO ( %L )  &#039; , current_year||&#039;-&#039;||current_month||&#039;-01&#039; , next_year||&#039;-&#039;||next_month||&#039;-01&#039;  ) ; \n\n      index_name := partition_name||&#039;_shipment_id_idx&#039;;\n      RAISE NOTICE &#039;NOME DO \u00cdNDICE =%&#039;,index_name;\n      EXECUTE format(&#039;CREATE INDEX &#039; || quote_ident(index_name) || &#039; ON &#039;|| quote_ident(partition_name) ||&#039; USING btree (&quot;SHIPMENT_ID&quot;) TABLESPACE pg_default &#039; ) ; \n\n      --Remove a marca da primeira vez\n      first_flag := false ;\n   \n  END LOOP;\n\nend\n$$;<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">Importando dump<\/b><\/p>\n<pre><code class=\"plaintext\">pg_restore -d postgres --data-only --format=c --table=shipment --verbose  shipment.dmp &gt; \/tmp\/data_dump\/shipment_restore.log 2&gt;&amp;1<\/code><\/pre>\n<p><\/p>\n<h2>Verificando os resultados da parti\u00e7\u00e3o<\/h2>\n<p>\nO que temos, ent\u00e3o, como resultado? O texto completo do plano \u00e9 extenso e ma\u00e7ante, portanto, \u00e9 poss\u00edvel se limitar aos n\u00fameros finais.<\/p>\n<h3>Foi<\/h3>\n<p>\n<b>Custo:<\/b> 502 997.55<br \/>\n<b>Tempo de execu\u00e7\u00e3o:<\/b> 505 segundos.<\/p>\n<h3>Tornou-se<\/h3>\n<p>\n<b>Custo:<\/b> 77 872.36<br \/>\n<b>Tempo de execu\u00e7\u00e3o:<\/b> 79 segundos.<\/p>\n<p>Um bom resultado. Reduzimos o custo e o tempo de execu\u00e7\u00e3o. Assim, o uso de particionamento traz o efeito esperado e, de modo geral, sem surpresas. <\/p>\n<h2>Alegrar o cliente<\/h2>\n<p>\nOs resultados dos testes foram apresentados ao cliente para considera\u00e7\u00e3o. E ap\u00f3s a revis\u00e3o, ele deu um veredicto um tanto inesperado: \"\u00d3timo, particione a tabela 'data'.\"<\/p>\n<p>Sim, mas n\u00f3s pesquisamos uma tabela completamente diferente, 'shipment', a tabela 'data' n\u00e3o possui o campo 'SHIPMENT_DATE'.<\/p>\n<p>Sem problemas, adicione e altere. O principal \u00e9 que o cliente esteja satisfeito com o que resultar\u00e1, os detalhes da implementa\u00e7\u00e3o n\u00e3o s\u00e3o t\u00e3o importantes.<\/p>\n<h2>Particionamos a tabela principal 'data'<\/h2>\n<p>\nNa verdade, n\u00e3o houve dificuldades especiais. Embora, o algoritmo de particionamento tenha mudado um pouco.<\/p>\n<p><b class=\"spoiler_title\">Adicionando a coluna 'SHIPMENT_DATA' \u00e0 tabela 'data'<\/b><\/p>\n<pre><code class=\"plaintext\">psql -h host -U banco -d usu\u00e1rio\n=&gt; ALTER TABLE data ADD COLUMN \"SHIPMENT_DATE\" timestamp without time zone ;<\/code><\/pre>\n<p><b class=\"spoiler_title\">Preenchendo os valores da coluna 'SHIPMENT_DATA' na tabela 'data' com os valores da coluna hom\u00f4nima da tabela 'shipment'<\/b><\/p>\n<pre><code class=\"plaintext\">-----------------------------\n--update_data.sql\n--atualizando a tabela \"data\" alterada para os valores de \"shipment_data\" da tabela \"shipment\"\n--vers\u00e3o 1.0\ndo language plpgsql $$\ndeclare \nrec_shipment_data RECORD ;\nshipment_date timestamp without time zone ; \nrow_count integer ;\ntotal_rows integer ;\nbegin\n\n  select count(*) into total_rows from shipment ; \n  RAISE NOTICE 'Total %',total_rows;\n  row_count:= 0 ;\n\n  FOR rec_shipment_data IN SELECT * FROM shipment LOOP\n\n   update data set \"SHIPMENT_DATE\" = rec_shipment_data.\"SHIPMENT_DATE\" where \"SHIPMENT_ID\" = rec_shipment_data.\"SHIPMENT_ID\";\n   \n   row_count:=  row_count +1 ;\n   RAISE NOTICE 'contagem de linhas = % , de %',row_count,total_rows;\n  END LOOP;\n\nend\n$$;<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">Salvando o dump da tabela 'data'<\/b><\/p>\n<pre><code class=\"plaintext\">pg_dump postgres --file=\\\/dump\\\/data.dmp --format=c --table=data --verbose &gt; \\\/dump\\\/data.log 2&gt;&amp;1&lt;\\\/source<\/code><\/pre>\n<p><b class=\"spoiler_title\">Reconstruindo a tabela particionada 'data'<\/b><\/p>\n<pre><code class=\"plaintext\">--create_partition_data.sql\n--criar parti\u00e7\u00f5es para a tabela \"wafer data\" pela coluna de intervalo \"shipment_data\" com dura\u00e7\u00e3o de um m\u00eas\n--vers\u00e3o 1.0\ndo language plpgsql $$\ndeclare \nrec_shipment_date RECORD ;\npartition_name varchar;\nindex_name varchar;\ncurrent_year varchar ;\ncurrent_month varchar ;\nbegin_year varchar ;\nbegin_month varchar ;\nnext_year varchar ;\nnext_month varchar ;\nfirst_flag boolean ;\ni integer ;\n\nbegin\n\n  RAISE NOTICE 'CRIAR TABELA TEMPOR\u00c1RIA PARA SHIPMENT_DATE';\n  CREATE TEMP TABLE tmp_shipment_date as select distinct \"SHIPMENT_DATE\" from shipment order by \"SHIPMENT_DATE\" ;\n\n\n  RAISE NOTICE 'CANCELAR TABELA data';\n  drop table data cascade ;\n\n\n  RAISE NOTICE 'CRIAR TABELA PARTICIONADA data';\n  \n  CREATE TABLE public.data\n  (\n    \"RUN_ID\" integer,\n    \"LASERMARK\" character varying(20) COLLATE pg_catalog.\"default\" NOT NULL,\n    \"LOTID\" character varying(80) COLLATE pg_catalog.\"default\",\n    \"SHIPMENT_ID\" integer NOT NULL,\n    \"PARAMETER_ID\" integer NOT NULL,\n    \"INTERNAL_VALUE\" character varying(75) COLLATE pg_catalog.\"default\",\n    \"REPORTED_VALUE\" character varying(75) COLLATE pg_catalog.\"default\",\n    \"LOWER_SPEC_LIMIT\" numeric,\n    \"UPPER_SPEC_LIMIT\" numeric , \n    \"SHIPMENT_DATE\" timestamp without time zone\n  )\n  PARTITION BY RANGE (\"SHIPMENT_DATE\")\n  WITH (\n    OIDS = FALSE\n  )\n  TABLESPACE pg_default ;\n\n\n  RAISE NOTICE 'CRIAR PARTI\u00c7\u00d5ES PARA A TABELA data';\n\n  current_year:='0';\n  current_month:='0';\n\n  begin_year := '0' ;\n  begin_month := '0'  ;\n  next_year := '0' ;\n  next_month := '0'  ;\n  i := 1;\n\n  FOR rec_shipment_date IN SELECT * FROM tmp_shipment_date LOOP\n      \n      RAISE NOTICE 'SHIPMENT_DATE=%',rec_shipment_date.\"SHIPMENT_DATE\";\n      \n      current_year := date_part('year' ,rec_shipment_date.\"SHIPMENT_DATE\");\n      current_month := date_part('month' ,rec_shipment_date.\"SHIPMENT_DATE\") ; \n\n      --Iniciar limites\n      IF   begin_year = '0' THEN\n       RAISE NOTICE '***Iniciar limites';\n       first_flag := true ; --flag da primeira vez\n       begin_year := current_year ;\n       begin_month := current_month ;   \n   \n        IF current_month = '12' THEN\n          next_year := date_part('year' ,rec_shipment_date.\"SHIPMENT_DATE\" + interval '1 year') ;\n        ELSE\n          next_year := current_year ;\n        END IF;\n     \n       next_month := date_part('month' ,rec_shipment_date.\"SHIPMENT_DATE\" + interval '1 month') ;\n\n      END IF;\n\n--      RAISE NOTICE 'current_year=% , current_month=% ',current_year,current_month;\n--      RAISE NOTICE 'begin_year=% , begin_month=% ',begin_year,begin_month;\n--      RAISE NOTICE 'next_year=% , next_month=% ',next_year,next_month;\n\n      -- Verificar a data atual nos limites N\u00c3O para a Primeira vez\n\n      RAISE NOTICE 'Dados atuais = %',to_char( to_date( current_year||'.'||current_month, 'YYYY.MM'), 'YYYY.MM');\n      RAISE NOTICE 'Dados Iniciais = %',to_char( to_date( begin_year||'.'||begin_month, 'YYYY.MM'), 'YYYY.MM');\n      RAISE NOTICE 'Pr\u00f3ximos dados = %',to_char( to_date( next_year||'.'||next_month, 'YYYY.MM'), 'YYYY.MM');\n\n      IF to_date( current_year||'.'||current_month, 'YYYY.MM') &gt;= to_date( begin_year||'.'||begin_month, 'YYYY.MM') AND \n         to_date( current_year||'.'||current_month, 'YYYY.MM') &lt; to_date( next_year||&#039;.&#039;||next_month, &#039;YYYY.MM&#039;) AND \n         NOT first_flag \n      THEN\n         RAISE NOTICE &#039;***CONTINUAR&#039;;\n         CONTINUE ; \n      ELSE\n       --NOVOS limites apenas para a segunda vez e seguintes \n       RAISE NOTICE &#039;***NOVOS LIMITES&#039;;\n       begin_year := current_year ;\n       begin_month := current_month ;   \n   \n        IF current_month = &#039;12&#039; THEN\n          next_year := date_part(&#039;year&#039; ,rec_shipment_date.&quot;SHIPMENT_DATE&quot; + interval &#039;1 year&#039;) ;\n        ELSE\n          next_year := current_year ;\n        END IF;\n     \n       next_month := date_part(&#039;month&#039; ,rec_shipment_date.&quot;SHIPMENT_DATE&quot; + interval &#039;1 month&#039;) ;\n\n\n      END IF;      \n\n      IF to_number(current_month,&#039;99&#039;) &lt; 10 THEN\n        current_month := &#039;0&#039;||current_month ; \n      END IF ;\n\n      IF to_number(begin_month,&#039;99&#039;) &lt; 10 THEN\n        begin_month := &#039;0&#039;||begin_month ; \n      END IF ;\n\n      IF to_number(next_month,&#039;99&#039;) &lt; 10 THEN\n        next_month := &#039;0&#039;||next_month ; \n      END IF ;\n\n      RAISE NOTICE &#039;current_year=% , current_month=% &#039;,current_year,current_month;\n      RAISE NOTICE &#039;begin_year=% , begin_month=% &#039;,begin_year,begin_month;\n      RAISE NOTICE &#039;next_year=% , next_month=% &#039;,next_year,next_month;\n\n      partition_name := &#039;data_&#039;||begin_year||begin_month||&#039;01_&#039;||next_year||next_month||&#039;01&#039;  ;\n\n      RAISE NOTICE &#039;N\u00daMERO DA PARTI\u00c7\u00c3O % , NOME DA TABELA =%&#039;,i , partition_name;\n      \n      EXECUTE format(&#039;CREATE TABLE &#039; || quote_ident(partition_name) || &#039; PARTITION OF data FOR VALUES FROM ( %L ) TO ( %L )  &#039; , begin_year||&#039;-&#039;||begin_month||&#039;-01&#039; , next_year||&#039;-&#039;||next_month||&#039;-01&#039;  ) ; \n\n      index_name := partition_name||&#039;_shipment_id_parameter_id_idx&#039;;\n      RAISE NOTICE &#039;NOME DO \u00cdNDICE =%&#039;,index_name;\n      EXECUTE format(&#039;CREATE INDEX &#039; || quote_ident(index_name) || &#039; ON &#039;|| quote_ident(partition_name) ||&#039; USING btree (&quot;SHIPMENT_ID&quot;, &quot;PARAMETER_ID&quot;) TABLESPACE pg_default &#039; ) ; \n\n      index_name := partition_name||&#039;_lasermark_idx&#039;;\n      RAISE NOTICE &#039;NOME DO \u00cdNDICE =%&#039;,index_name;\n      EXECUTE format(&#039;CREATE INDEX &#039; || quote_ident(index_name) || &#039; ON &#039;|| quote_ident(partition_name) ||&#039; USING btree (&quot;LASERMARK&quot; COLLATE pg_catalog.&quot;default&quot;) TABLESPACE pg_default &#039; ) ; \n\n      index_name := partition_name||&#039;_shipment_id_idx&#039;;\n      RAISE NOTICE &#039;NOME DO \u00cdNDICE =%&#039;,index_name;\n      EXECUTE format(&#039;CREATE INDEX &#039; || quote_ident(index_name) || &#039; ON &#039;|| quote_ident(partition_name) ||&#039; USING btree (&quot;SHIPMENT_ID&quot;) TABLESPACE pg_default &#039; ) ; \n\n      index_name := partition_name||&#039;_parameter_id_idx&#039;;\n      RAISE NOTICE &#039;NOME DO \u00cdNDICE =%&#039;,index_name;\n      EXECUTE format(&#039;CREATE INDEX &#039; || quote_ident(index_name) || &#039; ON &#039;|| quote_ident(partition_name) ||&#039; USING btree (&quot;PARAMETER_ID&quot;) TABLESPACE pg_default &#039; ) ; \n\n      index_name := partition_name||&#039;_shipment_date_idx&#039;;\n      RAISE NOTICE &#039;NOME DO \u00cdNDICE =%&#039;,index_name;\n      EXECUTE format(&#039;CREATE INDEX &#039; || quote_ident(index_name) || &#039; ON &#039;|| quote_ident(partition_name) ||&#039; USING btree (&quot;SHIPMENT_DATE&quot;) TABLESPACE pg_default &#039; ) ; \n\n      --Cancelar flag da primeira vez\n      first_flag := false ;\n\n  END LOOP;\nend\n$$;\n<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">Estamos carregando o dump criado na etapa 3.<\/b><\/p>\n<pre><code class=\"plaintext\">pg_restore -h host -u usu\u00e1rio -d banco --data-only --format=c --table=data --verbose data.dmp &gt; data_restore.log 2&gt;&amp;1<\/code><\/pre>\n<p>\n<b class=\"spoiler_title\">Criamos uma se\u00e7\u00e3o separada para dados antigos<\/b><\/p>\n<pre><code class=\"plaintext\">---------------------------------------------------\n--create_partition_for_old_dates.sql\n--criar parti\u00e7\u00f5es para manter dates antigos\n--vers\u00e3o 1.0\ndo language plpgsql $$\ndeclare\nrec_shipment_date RECORD;\npartition_name varchar;\nindex_name varchar;\n\nbegin\n\n      SELECT min(\"SHIPMENT_DATE\") AS min_date INTO rec_shipment_date from data;\n\n      RAISE NOTICE 'A data antiga \u00e9 %', rec_shipment_date.min_date;\n\n      partition_name := 'data_old_dates';\n\n      RAISE NOTICE 'NOME DA PARTI\u00c7\u00c3O \u00c9 %', partition_name;\n\n      EXECUTE format('CREATE TABLE ' || quote_ident(partition_name) || ' PARTITION OF data FOR VALUES FROM (%L) TO (%L)', '1900-01-01',\n              to_char(rec_shipment_date.min_date, 'YYYY') || '-' || to_char(rec_shipment_date.min_date, 'MM') || '-01');\n\n      index_name := partition_name || '_shipment_id_parameter_id_idx';\n      EXECUTE format('CREATE INDEX ' || quote_ident(index_name) || ' ON ' || quote_ident(partition_name) || ' USING btree (\"SHIPMENT_ID\", \"PARAMETER_ID\") TABLESPACE pg_default');\n\n      index_name := partition_name || '_lasermark_idx';\n      EXECUTE format('CREATE INDEX ' || quote_ident(index_name) || ' ON ' || quote_ident(partition_name) || ' USING btree (\"LASERMARK\" COLLATE pg_catalog.\"default\") TABLESPACE pg_default');\n\n      index_name := partition_name || '_shipment_id_idx';\n      EXECUTE format('CREATE INDEX ' || quote_ident(index_name) || ' ON ' || quote_ident(partition_name) || ' USING btree (\"SHIPMENT_ID\") TABLESPACE pg_default');\n\n      index_name := partition_name || '_parameter_id_idx';\n      EXECUTE format('CREATE INDEX ' || quote_ident(index_name) || ' ON ' || quote_ident(partition_name) || ' USING btree (\"PARAMETER_ID\") TABLESPACE pg_default');\n\n      index_name := partition_name || '_shipment_date_idx';\n      EXECUTE format('CREATE INDEX ' || quote_ident(index_name) || ' ON ' || quote_ident(partition_name) || ' USING btree (\"SHIPMENT_DATE\") TABLESPACE pg_default');\n\nend\n$$;<\/code><\/pre>\n<h3>Resultados finais:<\/h3>\n<p>\n<b>Foi<\/b><br \/>\n<b>Custo:<\/b> 502 997.55<br \/>\n<b>Tempo de execu\u00e7\u00e3o<\/b>: 505 segundos.<\/p>\n<p><b>Tornou-se<\/b><br \/>\n<b>Custo:<\/b> 68 533.70<br \/>\n<b>Tempo de execu\u00e7\u00e3o:<\/b> 69 segundos<\/p>\n<p>Digno, bastante digno. E considerando que ao longo do caminho conseguimos entender razoavelmente o mecanismo de particionamento no PostgreSQL 10 \u2014 Um \u00f3timo resultado.<\/p>\n<h2>Um desvio l\u00edrico<\/h2>\n<p>\n<b class=\"spoiler_title\">E podemos fazer ainda melhor \u2014 SIM, \u00c9 POSS\u00cdVEL!<\/b>Para isso, precisamos usar VIEW MATERIALIZADA.<br \/>\n<b class=\"spoiler_title\">CREATE MATERIALIZED VIEW LASERMARK_VIEW<\/b><\/p>\n<pre><code class=\"plaintext\">CREATE MATERIALIZED VIEW LASERMARK_VIEW\nAS\nSELECT w.\"LASERMARK\", MAX(s.\"SHIPMENT_DATE\") AS \"SHIPMENT_DATE\"\nFROM shipment s INNER JOIN data w ON s.\"SHIPMENT_ID\" = w.\"SHIPMENT_ID\"\nGROUP BY w.\"LASERMARK\";\n\nCREATE INDEX lasermark_vw_shipment_date_ind on lasermark_view USING btree (\"SHIPMENT_DATE\") TABLESPACE pg_default;\nanalyze lasermark_view;\n<\/code><\/pre>\n<p>\nMais uma vez, reescrevemos a consulta:<br \/>\n<b class=\"spoiler_title\">Consulta utilizando view materializada<\/b><\/p>\n<pre><code class=\"plaintext\">SELECIONE\n            p.\"PARAMETER_ID\" como parameter_id,\n            pc.\"PC_NAME\" como pc_name,\n            pc.\"CUSTOMER_PARTNUMBER\" como customer_partnumber,\n            w.\"LASERMARK\" como lasermark,\n            w.\"LOTID\" como lotid,\n            w.\"REPORTED_VALUE\" como reported_value,\n            w.\"LOWER_SPEC_LIMIT\" como lower_spec_limit,\n            w.\"UPPER_SPEC_LIMIT\" como upper_spec_limit,\n            p.\"TYPE_CALCUL\" como type_calcul,\n            s.\"SHIPMENT_NAME\" como shipment_name,\n            s.\"SHIPMENT_DATE\" como shipment_date,\n            extrair(ano de s.\"SHIPMENT_DATE\") como year,\n            extrair(m\u00eas de s.\"SHIPMENT_DATE\") como month,\n            s.\"REPORT_NAME\" como report_name,\n            p.\"STC_NAME\" como STC_name,\n            p.\"CUSTOMERPARAM_NAME\" como customerparam_name\n        DA dados w INTERNO JUNTE-se ao embarque s ON s.\"SHIPMENT_ID\" = w.\"SHIPMENT_ID\"\n             INTERNO JUNTE-se aos par\u00e2metros p ON p.\"PARAMETER_ID\" = w.\"PARAMETER_ID\"\n             INTERNO JUNTE-se ao embarque_pc sp ON s.\"SHIPMENT_ID\" = sp.\"SHIPMENT_ID\"\n             INTERNO JUNTE-se ao pc pc ON pc.\"PC_ID\" = sp.\"PC_ID\"\n             INTERNO JUNTE-se ao LASERMARK_VIEW md ON md.\"SHIPMENT_DATE\" = s.\"SHIPMENT_DATE\" E md.\"LASERMARK\" = w.\"LASERMARK\"\n        ONDE\n              s.\"SHIPMENT_DATE\" &gt;= '2018-07-01' E s.\"SHIPMENT_DATE\" &lt;= &#039;2018-09-30&#039;;\n<\/code><\/pre>\n<p>\n<b>E obtemos mais um resultado:<\/b><br \/>\n<b>Foi<\/b><br \/>\n<b>Custo:<\/b> 502 997.55<br \/>\n<b>Tempo de execu\u00e7\u00e3o<\/b>: 505 segundos<\/p>\n<p><b>Tornou-se<\/b><br \/>\n<b>Custo:<\/b> 42 481.16<br \/>\n<b>Tempo de execu\u00e7\u00e3o:<\/b> 43 segundos.<\/p>\n<p>Embora, claro, um resultado t\u00e3o promissor seja enganoso, \u00e9 preciso atualizar as representa\u00e7\u00f5es. Portanto, o tempo final de obten\u00e7\u00e3o de dados n\u00e3o ajudar\u00e1 muito. Mas como experimento, \u00e9 bastante interessante.<\/p>\n<p>Na verdade, como se revelou, mais uma vez obrigado <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/users\/asmm\/\" class=\"user_link\">asmm<\/a><\/noindex> e ao Habr !- <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/icl_services\/blog\/446314\/#comment_19973236\">a consulta ainda pode ser melhorada. <\/a><\/noindex><\/p>\n<h2>Ep\u00edlogo<\/h2>\n<p>\nEnt\u00e3o, o cliente est\u00e1 satisfeito. E <b>\u00e9 necess\u00e1rio <\/b>aproveitar a situa\u00e7\u00e3o. <\/p>\n<p><b>Nova tarefa<\/b>: O que pode ser pensado para aprofundar e expandir?<\/p>\n<p>E aqui vem \u00e0 mente \u2014 pessoal, n\u00e3o temos monitoramento de nossos bancos de dados PostgreSQL.<\/p>\n<p>Colocando a m\u00e3o no cora\u00e7\u00e3o, existe algum monitoramento em forma de Cloud Watch na AWS. Mas qual \u00e9 a utilidade desse monitoramento para um DBA? Praticamente nenhuma.<\/p>\n<p><b>Se surgiu a chance de fazer algo \u00fatil e interessante tamb\u00e9m para si, n\u00e3o se pode perder tal oportunidade\u2026<br \/>\nPOIS<br \/>\n<\/b><br \/>\n<img decoding=\"async\" alt=\"Happy Party ou algumas linhas de mem\u00f3rias sobre a introdu\u00e7\u00e3o ao particionamento no PostgreSQL10\" src=\"\/wp-content\/uploads\/2019\/04\/e514664a4a46f5379c51f57f24481746.jpeg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nAssim chegamos ao mais interessante:<\/p>\n<blockquote><p><b>3 de Dezembro de 2018.<\/b><br \/>\nDecis\u00e3o de iniciar trabalhos para investigar as possibilidades existentes de monitoramento de desempenho de consultas PostgreSQL.\n<\/p><\/blockquote>\n<p><b>Mas isso j\u00e1 \u00e9 uma hist\u00f3ria totalmente diferente.<\/b><\/p>\n<p><i>Continua\u00e7\u00e3o, segue...<\/i><br \/>\n<br \/>Fonte: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/icl_services\/blog\/446442\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435 \u0438\u043b\u0438 \u043a\u0430\u043a \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u041d\u0430\u0447\u0430\u043b\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0437\u0434\u0435\u0441\u044c: \u0422\u044b \u043f\u043e\u043c\u043d\u0438\u0448\u044c, \u043a\u0430\u043a \u0432\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e\u0441\u044c. \u0412\u0441\u0435 \u0431\u044b\u043b\u043e \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0438 \u0432\u043d\u043e\u0432\u044c. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u0431\u044b\u043b\u0438 \u0438\u0441\u0447\u0435\u0440\u043f\u0430\u043d\u044b, \u0432\u0441\u0442\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u0430 \u0447\u0442\u043e \u0436\u0435 \u0434\u0430\u043b\u044c\u0448\u0435? \u0422\u0430\u043a \u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f \u043e \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. \u041b\u0438\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435: \u0418\u043c\u0435\u043d\u043d\u043e &#8216;\u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442&#8217;, \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043a\u0430\u043a [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":23765,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-31905","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435 \u0438\u043b\u0438 \u043a\u0430\u043a \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u041d\u0430\u0447\u0430\u043b\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0437\u0434\u0435\u0441\u044c: \u0422\u044b \u043f\u043e\u043c\u043d\u0438\u0448\u044c, \u043a\u0430\u043a \u0432\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e\u0441\u044c.\" \/>\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\/pt\/blog\/administrirovanie\/happy-party-ili-para-strok-vospominanij-o-znakomstve-s-sektsionirovaniem-v-postgresql10\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"pt_PT\" \/>\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\udd47Happy Party \u0438\u043b\u0438 \u043f\u0430\u0440\u0430 \u0441\u0442\u0440\u043e\u043a-\u0432\u043e\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0439 \u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0435 \u0441 \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432 PostgreSQL10 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435 \u0438\u043b\u0438 \u043a\u0430\u043a \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u041d\u0430\u0447\u0430\u043b\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0437\u0434\u0435\u0441\u044c: \u0422\u044b \u043f\u043e\u043c\u043d\u0438\u0448\u044c, \u043a\u0430\u043a \u0432\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e\u0441\u044c.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/pt\/blog\/administrirovanie\/happy-party-ili-para-strok-vospominanij-o-znakomstve-s-sektsionirovaniem-v-postgresql10\" \/>\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-31T18:43:52+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:43:52+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\udd47Happy Party ou algumas linhas de lembran\u00e7as sobre o encontro com o particionamento no PostgreSQL10 | ProHoster","description":"Pref\u00e1cio ou como a ideia de particionamento surgiu Come\u00e7o da hist\u00f3ria aqui: Voc\u00ea se lembra de como tudo come\u00e7ou.","canonical_url":"https:\/\/prohoster.info\/pt\/blog\/administrirovanie\/happy-party-ili-para-strok-vospominanij-o-znakomstve-s-sektsionirovaniem-v-postgresql10","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"pt_PT","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\udd47Happy Party \u0438\u043b\u0438 \u043f\u0430\u0440\u0430 \u0441\u0442\u0440\u043e\u043a-\u0432\u043e\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0439 \u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0435 \u0441 \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432 PostgreSQL10 | ProHoster","og:description":"\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435 \u0438\u043b\u0438 \u043a\u0430\u043a \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u041d\u0430\u0447\u0430\u043b\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0437\u0434\u0435\u0441\u044c: \u0422\u044b \u043f\u043e\u043c\u043d\u0438\u0448\u044c, \u043a\u0430\u043a \u0432\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e\u0441\u044c.","og:url":"https:\/\/prohoster.info\/pt\/blog\/administrirovanie\/happy-party-ili-para-strok-vospominanij-o-znakomstve-s-sektsionirovaniem-v-postgresql10","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-31T18:43:52+00:00","article:modified_time":"2019-10-31T18:43:52+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"31905","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-21 08:22:19","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 03:09:25","updated":"2026-01-21 08:22:19","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/posts\/31905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/comments?post=31905"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/posts\/31905\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/media\/23765"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/media?parent=31905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/categories?post=31905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/tags?post=31905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}