{"id":305593,"date":"2020-06-19T09:00:28","date_gmt":"2020-06-19T09:00:28","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=305593"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=305593","title":{"rendered":"SQL HowTo: 1000 \u0438 \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/tensor\/blog\/507056\/\">\u041d\u0430\u0448 <a href=\"https:\/\/sbis.ru\/all_services\">\u0421\u0411\u0418\u0421<\/a>, \u043a\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u043e\u043c, \u043d\u0435 \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0431\u0435\u0437 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0447\u0435\u0442\u043e\u0432 \u2014 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043b\u044e\u0431\u0438\u0442 \u0441\u0432\u043e\u0434\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0441\u044f\u043a\u0438\u0435 \u0441\u0443\u043c\u043c\u044b \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u043c \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0435 &quot;<i>\u0418\u0442\u043e\u0433\u043e<\/i>&quot;.<\/p>\n<p>  \u0410 \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u0438 \u0438\u0442\u043e\u0433\u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c <b>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u0441\u0443\u043c\u043c\u0430, \u0441\u0440\u0435\u0434\u043d\u0435\u0435, \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c,\u2026 \u2014 \u0438, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0435 \u043e\u0434\u043d\u043e\u0439.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ah\/xs\/xb\/ahxsxbntkmfs884ggqqqvoeyqbc.png\"><\/div>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b \u0432 PostgreSQL \u0438\u043b\u0438 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0421\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u044b\u0435 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b<\/h2>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u0447\u0443\u0442\u044c \u043f\u043e\u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0447\u0435\u043c \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u0430. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 <b>\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e<\/b>, \u0438 \u043f\u0443\u0441\u0442\u044c \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 <i>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0441\u0443\u043c\u043c\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432<\/i> \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0445\u043e\u0434\u043d\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435:<\/p>\n<pre><code class=\"plaintext\">-&gt;   $1 = '{2,3,5,7,11,13,17,19}' &lt;-   count | sum       8 |  77<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0441\u0430\u043c\u044b\u0439-\u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u0438\u0448\u0435\u043c <code>count<\/code> \u0438 <code>sum<\/code>:<\/p>\n<pre><code class=\"sql\">SELECT   count(*) , sum(prime) FROM   unnest('{2,3,5,7,11,13,17,19}'::integer[]) prime;<\/code><\/pre>\n<p>  \u0418 \u0445\u043e\u0442\u044c \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u0432\u0435, \u0432 \u043f\u043b\u0430\u043d\u0435 \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u2014 \u0443\u0437\u0435\u043b <code>Aggregate<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0440\u0430\u0437:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sp\/ef\/2e\/spef2ek8ukw3zqfiirudcrs3amm.png\"><\/p>\n<h2>\u00ab\u041d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0435\u00bb \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b<\/h2>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432, \u043d\u043e \u0432\u043e\u0442 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u2014 <b>\u0440\u0430\u0437\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f [\u043d\u0435]\u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0437\u0430\u043f\u0438\u0441\u0438<\/b> \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 <i>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0438\u0441\u0435\u043b \u0431\u043e\u043b\u044c\u0448\u0435 \u0438 \u043c\u0435\u043d\u044c\u0448\u0435 10<\/i> \u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438:<\/p>\n<pre><code class=\"plaintext\">-&gt;   $1 = '{2,3,5,7,11,13,17,19}' &lt;-   countlt | countgt         4 |       4<\/code><\/pre>\n<p>  <\/p>\n<h4>\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/h4>\n<p>  \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u2014 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043a CTE, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u00ab\u0432\u044b\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u00bb \u0441\u0435\u0431\u0435 \u0438\u0437 \u043e\u0431\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e\u0434 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u00ab\u043a\u0443\u0441\u043e\u0447\u0435\u043a\u00bb, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043d\u0430 \u043d\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u0433\u0440\u0435\u0433\u0430\u0442:<\/p>\n<pre><code class=\"sql\">WITH src AS (   SELECT unnest('{2,3,5,7,11,13,17,19}'::integer[]) prime )  SELECT   (SELECT count(*) FROM src WHERE prime &lt; 10) countlt , (SELECT count(*) FROM src WHERE prime &gt; 10) countgt;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kb\/0b\/oo\/kb0boo1t7wsbek1rzzcc1vhk828.png\"><\/p>\n<p>  \u041a\u0430\u043a\u0438\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u043b\u0430\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b? \u041c\u043d\u043e\u0433\u043e \u0431\u0435\u0433\u0430\u0435\u043c \u0438 \u043c\u043d\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u2014 \u0434\u0432\u0430\u0436\u0434\u044b <code>[CTE Scan + Rows Removed by Filter: 4]<\/code>.<\/p>\n<p>  \u0410 \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437 10K \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0430 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f 3-4-5?.. \u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<h4>FILTER-\u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b<\/h4>\n<p>  \u042d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439:<\/p>\n<pre><code class=\"sql\">SELECT   count(*) FILTER(WHERE prime &lt; 10) countlt , count(*) FILTER(WHERE prime &gt; 10) countgt FROM   unnest('{2,3,5,7,11,13,17,19}'::integer[]) prime;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fc\/3j\/kp\/fc3jkpnmgbcnqrmewxutoegi-5c.png\"><\/p>\n<p>  \u041e\u043d \u0438\u0434\u0435\u0430\u043b\u0435\u043d \u0432\u043e \u0432\u0441\u0435\u0445 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f\u0445, \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0435\u0448\u0430\u0435\u0442 \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0438 \u043b\u043e\u0436\u043a\u0443 \u0434\u0435\u0433\u0442\u044f \u2014 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d <a href=\"https:\/\/www.depesz.com\/2013\/07\/23\/waiting-for-9-4-implement-the-filter-clause-for-aggregate-function-calls\/\">\u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 9.4<\/a> (\u043c\u0430\u043b\u043e \u043b\u0438 \u0443 \u043a\u043e\u0433\u043e \u0447\u0442\u043e \u00ab\u043d\u0430 \u0431\u043e\u044e\u00bb \u0441\u0442\u043e\u0438\u0442).<\/p>\n<h4>\u0410\u0433\u0440\u0435\u0433\u0430\u0442\u044b \u043e\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/h4>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, 9.4 \u0435\u0449\u0435 \u043d\u0435 \u043f\u043e\u0434\u0432\u0435\u0437\u043b\u0438, \u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u00ab\u0432 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434\u00bb. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0437\u043d\u0430\u043d\u0438\u0435\u043c, \u0447\u0442\u043e <b><code>count(*) FILTER(WHERE cond)<\/code> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <code>sum(CASE cond)<\/code><\/b>:<\/p>\n<pre><code class=\"sql\">SELECT   sum(CASE WHEN prime &lt; 10 THEN 1 ELSE 0 END) countlt , sum(CASE WHEN prime &gt; 10 THEN 1 ELSE 0 END) countgt FROM   unnest('{2,3,5,7,11,13,17,19}'::integer[]) prime;<\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0447\u0443\u0442\u044c \u043a\u043e\u0440\u043e\u0447\u0435, \u0435\u0441\u043b\u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <b>\u0441\u043a\u0430\u0441\u0442\u043e\u0432\u0430\u0442\u044c <code>boolean<\/code> \u0432 <code>integer<\/code><\/b> \u0432\u043c\u0435\u0441\u0442\u043e <code>CASE<\/code> \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 1\/0:<\/p>\n<pre><code class=\"sql\">SELECT   sum((prime &lt; 10)::integer) countlt , sum((prime &gt; 10)::integer) countgt FROM   unnest('{2,3,5,7,11,13,17,19}'::integer[]) prime;<\/code><\/pre>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435, \u043f\u043e\u0434\u0445\u043e\u0434 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u0430 \u043e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u0435\u043d, \u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0438 \u0441\u0432\u043e\u0438 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438.<\/p>\n<h2>\u0410\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432<\/h2>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0438\u0441\u0435\u043b, \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u043e\u0434 \u0442\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0438\u0437 \u043d\u0438\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0435:<\/p>\n<pre><code class=\"plaintext\">-&gt;   $1 = '{2,3,5,7,11,13,17,19}' &lt;-    primeslt |   primesgt   {2,3,5,7} | {11,13,17,19} <\/code><\/pre>\n<p>  \u0418 \u0442\u0443\u0442 \u043d\u0430\u043c \u0442\u043e\u0436\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0430\u0433\u0440\u0435\u0433\u0430\u0442 \u2014 \u0432\u0435\u0434\u044c \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u043e \u0442\u0438\u043f \u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043a\u0430\u043b\u044f\u0440\u043e\u043c, \u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <b><code>array_agg<\/code><\/b>.<\/p>\n<p>  \u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <code>FILTER<\/code> \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d:<\/p>\n<pre><code class=\"sql\">WITH src AS (   SELECT unnest('{2,3,5,7,11,13,17,19}'::integer[]) prime ) SELECT   array_agg(prime) FILTER(WHERE prime &lt; 10) primeslt , array_agg(prime) FILTER(WHERE prime &gt; 10) primesgt FROM   src;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/iq\/jy\/kh\/iqjykhllbtd3elbzl8vy5t3qxbo.png\"><\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0430\u0433\u0440\u0435\u0433\u0430\u0442 \u043e\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u2014 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0435\u043c \u0432 \u043d\u0430\u0431\u043e\u0440 <code>NULL<\/code>&#8216;\u043e\u0432, \u0447\u0442\u043e \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0432\u0435\u0441\u0435\u043b\u043e:<\/p>\n<pre><code class=\"sql\">WITH src AS (   SELECT unnest('{2,3,5,7,11,13,17,19}'::integer[]) prime )  , tmp AS (   SELECT     array_agg(CASE WHEN prime &lt; 10 THEN prime END) primeslt -- {2,3,5,7,NULL,NULL,NULL,NULL}   , array_agg(CASE WHEN prime &gt; 10 THEN prime END) primesgt -- {NULL,NULL,NULL,NULL,11,13,17,19}   FROM     src ) SELECT   ARRAY(SELECT * FROM unnest(primeslt) prime WHERE prime IS NOT NULL) primeslt , ARRAY(SELECT * FROM unnest(primesgt) prime WHERE prime IS NOT NULL) primesgt FROM   tmp;<\/code><\/pre>\n<p>  \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0445\u043e\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0437\u043b\u043e, \u0438 \u0441\u0442\u043e\u0438\u0442 \u0445\u043e\u0442\u044f \u0431\u044b \u0432\u0435\u0440\u0441\u0438\u044f 9.3, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <b><code>array_remove<\/code><\/b> \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e \u0436\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0430:<\/p>\n<pre><code class=\"sql\">WITH src AS (   SELECT unnest('{2,3,5,7,11,13,17,19}'::integer[]) prime )  SELECT   array_remove(array_agg(CASE WHEN prime &lt; 10 THEN prime END), NULL) primeslt , array_remove(array_agg(CASE WHEN prime &gt; 10 THEN prime END), NULL) primesgt FROM   src;<\/code><\/pre>\n<p>  <\/p>\n<h4>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432: Function Scan vs CTE<\/h4>\n<p>  \u041c\u044b \u0442\u0443\u0442 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u043b\u0438 \u043d\u0430\u0448 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0432 CTE \u2014 \u0430 \u043f\u043e\u0447\u0435\u043c\u0443? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0430\u043a \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<pre><code class=\"sql\">SELECT   array_agg(i) FILTER(WHERE i % 2 = 0) even , array_agg(i) FILTER(WHERE i % 2 = 1) odd FROM   generate_series(1, 1000000) i;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vn\/go\/ly\/vngolyvpblwtmu1dt072qyui5yw.png\"><\/p>\n<pre><code class=\"sql\">WITH src AS (   SELECT generate_series(1, 1000000) i ) SELECT   array_agg(i) FILTER(WHERE i % 2 = 0) even , array_agg(i) FILTER(WHERE i % 2 = 1) odd FROM   src;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ep\/d4\/3h\/epd43hjxi88errmg2etcx_ovsy8.png\"><\/p>\n<p>  \u041f\u043e\u0447\u0442\u0438 \u043d\u0430 40% \u0431\u044b\u0441\u0442\u0440\u0435\u0435! \u041f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u044b\u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0439, \u043d\u043e \u044d\u0444\u0444\u0435\u043a\u0442 \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u0431\u044b\u0442\u044c.<\/p>\n<h4>DISTINCT + OVER<\/h4>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u00ab\u0437\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u00bb \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>DISTINCT<\/code> \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u00ab\u043e\u043a\u043d\u0430\u00bb \u043a \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"sql\">WITH src AS (   SELECT unnest('{2,3,5,7,11,13,17,19}'::integer[]) prime ) SELECT DISTINCT   array_agg(prime) FILTER(WHERE prime &lt; 10) OVER() primeslt , array_agg(prime) FILTER(WHERE prime &gt; 10) OVER() primesgt FROM   src; <\/code><\/pre>\n<p>  \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u0442\u0430\u043a\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u00ab\u043d\u0435\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0430\u00bb:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7v\/oz\/ox\/7vozox1fuee39ugcookftsuhnky.png\"><\/p>\n<h2>\u0421\u043b\u043e\u0436\u043d\u044b\u0439 \u0430\u0433\u0440\u0435\u0433\u0430\u0442<\/h2>\n<p>  \u041d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0447\u0442\u043e-\u0442\u043e \u00ab\u044d\u0442\u0430\u043a\u043e\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435\u00bb, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u0430:<\/p>\n<pre><code class=\"plaintext\">-&gt;   $1 = '{2,3,5,7,11,13,17,19}' &lt;-                  exp                  |   val   2 * 3 * 5 * 7 * 11 * 13 * 17 * 19 = | 9699690 <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c <b>\u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/b> \u0432\u0441\u0435\u0445 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0447\u0438\u0441\u0435\u043b, \u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u043d\u0435\u0442\u0443. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e <a href=\"https:\/\/stackoverflow.com\/questions\/21623282\/multiplynum-aggregate-function-in-postgresql\">\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c<\/a>, \u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u044d\u0442\u043e \u043d\u0435\u0441\u043f\u043e\u0440\u0442\u0438\u0432\u043d\u043e \u2014 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0440\u0435\u0434\u043a\u043e.<\/p>\n<p>  \u0421\u043e\u0431\u0435\u0440\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0448\u0438\u0442 \u043d\u0430\u0448\u0443 \u0437\u0430\u0434\u0430\u0447\u0443:<\/p>\n<pre><code class=\"sql\">WITH RECURSIVE src AS (   SELECT     *   FROM     unnest('{2,3,5,7,11,13,17,19}'::integer[])       WITH ORDINALITY T(prime, rn) ) , T(rn, exp, val) AS (   SELECT     0::bigint     -- \u0431\u0430\u0437\u0430 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438   , '{}'::integer[]   , 1 UNION ALL   SELECT     src.rn     -- \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435\u0445 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432   , exp || src.prime   , val * src.prime    FROM     T   JOIN     src       ON src.rn = T.rn + 1 -- \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 ) SELECT   array_to_string(exp, ' * ') || ' = ' exp , val FROM   T ORDER BY -- \u043e\u0442\u0431\u043e\u0440 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430   rn DESC LIMIT 1;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sw\/hg\/0h\/swhg0hy9odcfxlsk0oshau2s9zo.png\"><\/p>\n<p>  \u041a\u0443\u0447\u0435\u0440\u044f\u0432\u043e! \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0438 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c, \u043e\u043f\u0438\u0440\u0430\u044f\u0441\u044c \u043d\u0430 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u2014 \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u043d \u043f\u043e\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043d\u043e:<\/p>\n<pre><code class=\"sql\">WITH RECURSIVE src AS (   SELECT '{2,3,5,7,11,13,17,19}'::integer[] arr ) , T(i, exp, val) AS (   SELECT     1::bigint     -- \u0431\u0430\u0437\u0430 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438   , '{}'::integer[]   , 1 UNION ALL   SELECT     i + 1     -- \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435\u0445 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432   , exp || arr[i]   , val * arr[i]   FROM     T   , src   WHERE     i &lt;= array_length(arr, 1) ) SELECT   array_to_string(exp, ' * ') || ' = ' exp , val FROM   T ORDER BY -- \u043e\u0442\u0431\u043e\u0440 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430   i DESC LIMIT 1;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_n\/q4\/md\/_nq4mdd-oaj_kamxpy1cp5h9ula.png\"><\/p>\n<p>  \u041d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435!<\/p>\n<h4>Math.bonus<\/h4>\n<p>  \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c <b><code>string_agg<\/code><\/b> \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u0430\u0433\u0438\u0438:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fy\/lt\/gt\/fyltgtgygx-3cqqvq7vd_3wnfgs.png\"><\/p>\n<pre><code class=\"sql\">WITH src AS (   SELECT unnest('{2,3,5,7,11,13,17,19}'::integer[]) prime ) SELECT   string_agg(prime::text, ' * ') || ' = ' exp , exp(sum(ln(prime)))::integer val -- \u0434\u043b\u044f \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 FROM   src;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/o_\/ra\/1d\/o_ra1d5lyglyindxebspucafsyc.png\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/tensor\/blog\/507056\/\"> https:\/\/habr.com\/ru\/company\/tensor\/blog\/507056\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/tensor\/blog\/507056\/\">\u041d\u0430\u0448 <a href=\"https:\/\/sbis.ru\/all_services\">\u0421\u0411\u0418\u0421<\/a>, \u043a\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u043e\u043c, \u043d\u0435 \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0431\u0435\u0437 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0447\u0435\u0442\u043e\u0432 \u2014 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043b\u044e\u0431\u0438\u0442 \u0441\u0432\u043e\u0434\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0441\u044f\u043a\u0438\u0435 \u0441\u0443\u043c\u043c\u044b \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u043c \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0435 &quot;<i>\u0418\u0442\u043e\u0433\u043e<\/i>&quot;.<\/p>\n<p>  \u0410 \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u0438 \u0438\u0442\u043e\u0433\u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c <b>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u0441\u0443\u043c\u043c\u0430, \u0441\u0440\u0435\u0434\u043d\u0435\u0435, \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c,\u2026 \u2014 \u0438, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0435 \u043e\u0434\u043d\u043e\u0439.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ah\/xs\/xb\/ahxsxbntkmfs884ggqqqvoeyqbc.png\"><\/div>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b \u0432 PostgreSQL \u0438\u043b\u0438 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-305593","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305593","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=305593"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305593\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}