<html><body><span style="display:block;" class="xfm_18571499"><div><span style="font-size:12pt;line-height:14pt;font-family:Arial;" class="xfmc1">Хай,</span><br/></div>
<div><span style="font-size:12pt;line-height:14pt;font-family:Arial;" class="xfmc1"><br data-mce-bogus="1"/></span></div>
<div><span style="font-size:12pt;line-height:14pt;font-family:Arial;" class="xfmc1">shared memory size у 20% БД та віддати її у Постгрес на його буфера.<br data-mce-bogus="1"/></span></div>
<div><span style="font-size:12pt;line-height:14pt;font-family:Arial;" class="xfmc1"><br data-mce-bogus="1"/></span></div>
<div><span style="font-size:12pt;line-height:14pt;font-family:Arial;" class="xfmc1">Років 10-15 тому я експериментував із цією проблемою рестора і там була пряма залежність від наданої пам'яті.<br data-mce-bogus="1"/></span></div>
<div><span style="font-size:12pt;line-height:14pt;font-family:Arial;" class="xfmc1"><br data-mce-bogus="1"/></span></div>
<div><span style="font-size:12pt;line-height:14pt;font-family:Arial;" class="xfmc1">Доречі у мускуля така ж хрінота є, залежить від sort_buffer_size кажися.<br data-mce-bogus="1"/></span></div>
<div><span style="font-size:12pt;line-height:14pt;font-family:Arial;" class="xfmc1"><br data-mce-bogus="1"/></span></div>
<div><span style="font-size:12pt;line-height:14pt;font-family:Arial;" class="xfmc1">ps: для 150Гб бази 48Гб рами - андерпровіжнінг<br data-mce-bogus="1"/></span></div>
<div><span style="font-size:12pt;line-height:14pt;font-family:Arial;" class="xfmc1"><br data-mce-bogus="1"/></span></div>
<div>
<div>
<div>
<div><b><span style="font-size:14pt;line-height:18pt;"><span style="font-family:Arial;">20.4.1. Memory</span></span></b></div>
</div>
</div>
</div>
<div><span style="font-family:Arial;font-size:12pt;line-height:14pt;">shared_buffers</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;"> (</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">integer</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">) </span>
<div><span style="font-family:Arial;font-size:12pt;line-height:14pt;">Sets the amount of memory the database server uses for shared memory buffers. The default is typically 128 megabytes (</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">128MB</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">), but might be less if your kernel settings will not support it (as determined during </span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">initdb</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">).
 This setting must be at least 128 kilobytes. However, settings 
significantly higher than the minimum are usually needed for good 
performance. If this value is specified without units, it is taken as 
blocks, that is </span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">BLCKSZ</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;"> bytes, typically 8kB. (Non-default values of </span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">BLCKSZ</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;"> change the minimum value.) This parameter can only be set at server start.</span></div>
<div><span style="font-family:Arial;font-size:12pt;line-height:14pt;">If you have a dedicated database server with 1GB or more of RAM, a reasonable starting value for </span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">shared_buffers</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;"> is 25% of the memory in your system. There are some workloads where even larger settings for </span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">shared_buffers</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;"> are effective, but because </span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">PostgreSQL</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;"> also relies on the operating system cache, it is unlikely that an allocation of more than 40% of RAM to </span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">shared_buffers</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;"> will work better than a smaller amount.<b> Larger settings for </b></span><b><span style="font-family:Arial;font-size:12pt;line-height:14pt;">shared_buffers</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;"> usually require a corresponding increase in </span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">max_wal_size</span><span style="font-family:Arial;font-size:12pt;line-height:14pt;">, in order to spread out the process of writing large quantities of new or changed data over a longer period of time.</span></b></div>
<div><span style="font-family:Arial;font-size:12pt;line-height:14pt;">On systems with less than 1GB of RAM, a smaller percentage 
of RAM is appropriate, so as to leave adequate space for the operating 
system.</span></div>
</div>
<div><br/></div>
<div><i><span style="font-size:10pt;line-height:12pt;"><span style="font-family:Arial;">8 червня 2022, 15:57:42, від
    "Oleh Hrynchuk" <</span><a href="mailto:oleh.hrynchuk@gmail.com" target="_blank"><span style="font-family:Arial;">oleh.hrynchuk@gmail.com</span></a><span style="font-family:Arial;">>:
</span></span></i></div>
<div><br/></div>
<blockquote style="border-left:1px solid #cccccc;margin:0px 0px 0px 0.8ex;padding-left:1ex;">
<div style="display:block;">
<div>Привіт усім.<br/><br/>Маю стійке переконання, що щось не відтюнено в мене на серваку. Але що не пробував - ефекту нуль.<br/><br/>Суть:<br/>Є досить здорова база постгреса, під 150 GB. В ній штук 10-12 здорових (5-16 GB) таблиць із здоровими індексами.<br/><div>pg_dump на ній "в 5 смичків" (-j5) відпрацьовує за лічені хвилини. А ось на іншій машині під Ubuntu 18.04 (2 x Intel(R) Xeon(R) CPU X5675 @ 3.07GHz, 48 GB RAM, 1TB SSD) pg_restore цієї БД (твкож з -j5) триває 15 годин!!!</div>
<br/>Які параметри postgresql.conf чи sysctl.conf показати?<br/>Де що в консерваторії підкрутити?<br/><br/>Коли глянути htop під час pg_restore - всі 12 cores ніби досить рівномірно завантажені (ну в залежності від обробки тих чи інших таблиць), пам"ять також нормально юзається під буфери та кеш.. а всеодно ресториться все з черепашою швидкістю :(<br/><br/>Перепробував різні тюнінги "з книжок" та/чи "як пишуть розумні люди в отих ваших інтернетах". І поки-що нуль ефекту :(. Достало... (((<br/><br/>-- <br/><div>
<div>
<div>Regards,<br/>/oleh hrynchuk</div>
</div>
</div>
</div>
</div>
<pre style="margin:5px 0;">_______________________________________________
uanog mailing list
<a href="mailto:uanog@uanog.kiev.ua" target="_self" rel="noreferrer noopener">uanog@uanog.kiev.ua</a>
<a href="https://mailman.uanog.kiev.ua/mailman/listinfo/uanog" target="_blank" rel="noreferrer noopener">https://mailman.uanog.kiev.ua/mailman/listinfo/uanog</a>

</pre>
</blockquote></span></body></html>