{"id":320486,"date":"2021-03-29T21:00:40","date_gmt":"2021-03-29T21:00:40","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=320486"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=320486","title":{"rendered":"\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043e PostgreSQL 13, Testcontainers \u0438 \u0431\u0430\u0433\u0430\u0445"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442 \u0425\u0430\u0431\u0440!<\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043c\u0435\u0441\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 PostgreSQL \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/habr.com\/ru\/post\/490824\/\" rel=\"noopener noreferrer nofollow\">pg-index-health<\/a>. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0437\u0430\u0440\u0435\u043b\u0438\u0437\u0438\u043b \u0432\u0435\u0440\u0441\u0438\u044e <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/releases\/tag\/v0.3.1\" rel=\"noopener noreferrer nofollow\">0.3.1<\/a>, \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u043b\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 <a href=\"https:\/\/www.postgresql.org\/about\/news\/postgresql-13-released-2077\/\" rel=\"noopener noreferrer nofollow\">PostgreSQL 13<\/a>.<\/p>\n<p>\u042d\u0442\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u0430\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0430\u0432\u043d\u043e, \u0435\u0449\u0451 \u0432 \u043e\u043a\u0442\u044f\u0431\u0440\u0435 2020. \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 embedded \u0432\u0435\u0440\u0441\u0438\u0438 \u0421\u0423\u0411\u0414 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445, \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 Testcontainers, \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0432 PG13 \u0438 \u0434\u0430\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0435 \u0441 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u041f\u043e\u0441\u0442\u0433\u0440\u0435\u0441\u0430&#8230; \u041d\u043e \u043e\u0431\u043e \u0432\u0441\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/af2\/267\/dd3\/af2267dd337f76da87353c5258ece828.jpg\" width=\"780\" height=\"457\"><figcaption><\/figcaption><\/figure>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b embedded PostgreSQL. \u042f \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043e\u0431 \u044d\u0442\u043e\u043c <a href=\"https:\/\/habr.com\/ru\/post\/501454\/\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u043d\u0435\u0435<\/a>. \u0412 \u0446\u0435\u043b\u043e\u043c \u044d\u0442\u043e \u0431\u044b\u043b \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043d\u043e \u043e\u043d \u0437\u0430\u0432\u044f\u0437\u0430\u043d \u043d\u0430 \u0447\u0443\u0436\u0438\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0438 \u0438 \u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u0410\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u0430 \u0441 13-\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u0431\u044b\u043b\u043e (\u0437\u0430\u0440\u0435\u043b\u0438\u0437\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/mvnrepository.com\/artifact\/io.zonky.test.postgres\/embedded-postgres-binaries-bom\/13.0.0\" rel=\"noopener noreferrer nofollow\">13 \u043d\u043e\u044f\u0431\u0440\u044f<\/a>, \u0441\u043f\u0443\u0441\u0442\u044f \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u043c\u0435\u0441\u044f\u0446\u0430 \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u043e\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432). \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u0436\u0438\u0442\u044c \u0441 \u0442\u0430\u043a\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0431\u044b\u043b\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e.<\/p>\n<p>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0442\u043e\u0436\u0435 \u0431\u044b\u043b \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d \u2013 <a href=\"https:\/\/www.testcontainers.org\/\" rel=\"noopener noreferrer nofollow\">Testcontainers<\/a> (\u0441\u043f\u0430\u0441\u0438\u0431\u043e \u041d\u0438\u043a\u043e\u043b\u0430\u044e \u041a\u043e\u043d\u0434\u0440\u0430\u0442\u044c\u0435\u0432\u0443 \u0437\u0430 \u0432\u0441\u044e <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/pull\/47\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443<\/a>), \u043d\u043e \u043c\u043d\u0435 \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Testcontainers \u2014 \u044d\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u043b\u0441\u0442\u044b\u0439 \u0441\u043b\u043e\u0439 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u0431\u0430\u0437\u043e\u0439, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u043e\u0439 \u0432 Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435. \u041d\u0430 MacOS \u0438 Windows \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f. \u0418 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u044d\u0442\u0438\u043c. \u0414\u0432\u0430\u0436\u0434\u044b. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 <a href=\"https:\/\/github.com\/testcontainers\/testcontainers-java\/issues\/3166\" rel=\"noopener noreferrer nofollow\">\u043d\u0430 MacOS<\/a>, \u0437\u0430\u0442\u0435\u043c <a href=\"https:\/\/github.com\/testcontainers\/testcontainers-java\/issues\/3493\" rel=\"noopener noreferrer nofollow\">\u043d\u0430 Windows<\/a>.<\/p>\n<p>\u041d\u043e \u0447\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0435\u0447\u0430\u043b\u044c\u043d\u043e, \u0432 Github Actions \u0442\u0435\u0441\u0442\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Testcontainers \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Ubuntu. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0434\u043b\u044f Windows \u0438 MacOS. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0441\u0432\u044f\u0437\u043a\u0443, \u0431\u0443\u0434\u0443 \u043f\u0440\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d \u0437\u0430 \u0441\u043e\u0432\u0435\u0442.<\/p>\n<p>\u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u0432 \u043c\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0430 Testcontainers \u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0438 \u043d\u0430 11-\u0439 \u0438 12-\u0439 \u0432\u0435\u0440\u0441\u0438\u044f\u0445. \u0417\u0430\u0442\u0435\u043c \u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u0432\u0430\u043d\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u0441 13.0&#8230; \u0418 \u0442\u0443\u0442 \u043c\u0435\u043d\u044f \u0436\u0434\u0430\u043b \u043e\u0431\u043b\u043e\u043c&#8230; \u0422\u0435\u0441\u0442\u044b \u043d\u0430 \u043e\u0446\u0435\u043d\u043a\u0443 bloat&#8217;\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0443\u043f\u0430\u043b\u0438. <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/tree\/demo\/postgresql-13-bug\" rel=\"noopener noreferrer nofollow\">\u0412 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0442\u043a\u0435<\/a> \u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/195\/4c8\/bd5\/1954c8bd5c308f44ad9f83bb37cbd176.png\" alt=\"\u041e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u043d\u0430 PostgreSQL 13.0\" title=\"\u041e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u043d\u0430 PostgreSQL 13.0\" width=\"1049\" height=\"573\"><figcaption>\u041e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u043d\u0430 PostgreSQL 13.0<\/figcaption><\/figure>\n<p>\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0430\u043b. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b \u043b\u043e\u043c\u0430\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 12-\u0439 \u0438 13-\u0439 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e. \u0423\u0433\u043b\u0443\u0431\u043b\u0451\u043d\u043d\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 <a href=\"https:\/\/www.postgresql.org\/docs\/release\/13.0\/\" rel=\"noopener noreferrer nofollow\">release notes<\/a> \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u043e \u043c\u0435\u043d\u044f \u0441\u043e \u0441\u0436\u0430\u0442\u0438\u0435\u043c \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0432 b-tree \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0445 \u0432 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 &#8212; \u0444\u0438\u0447\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0440\u0430\u043d\u0435\u0435 \u043a\u0430\u043a-\u0442\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u043f\u0443\u0441\u0442\u0438\u043b (\u0434\u0430, \u0442\u0430\u043a \u0442\u043e\u0436\u0435 \u0431\u044b\u0432\u0430\u0435\u0442).<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0441\u0442\u0430\u043b\u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0438\u0437\u043c\u0435\u043d\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f (\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043d\u0435\u0442 &#8212; \u043d\u0430 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b PostgreSQL \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u0431\u044b\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0441\u0438\u043b). \u041d\u043e \u0432\u043e\u0442 &#171;\u0431\u0430\u0433 \u044d\u0442\u043e \u0438\u043b\u0438 \u0444\u0438\u0447\u0430&#187; \u0438 \u043a\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c bloat \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u044f \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043b. \u0412 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u0445 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p>\u0418 \u0442\u043e\u0433\u0434\u0430 \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0441\u043e\u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u043f\u043e \u0441\u0436\u0430\u0442\u0438\u044e \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0432 b-tree \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0445 &#8212; <a href=\"https:\/\/postgrespro.ru\/blog\/pgsql\/5129505\" rel=\"noopener noreferrer nofollow\">\u0410\u043d\u0430\u0441\u0442\u0430\u0441\u0438\u0438 \u041b\u0443\u0431\u0435\u043d\u043d\u0438\u043a\u043e\u0432\u043e\u0439<\/a>. \u0418\u2026 \u043d\u0435\u0442, \u0437\u0434\u0435\u0441\u044c happy end&#8217;\u0430 \u043d\u0435 \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c: \u0443 \u0410\u043d\u0430\u0441\u0442\u0430\u0441\u0438\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0430 \u043f\u043e\u0442\u043e\u043c \u043d\u0430\u0432\u0430\u043b\u0438\u043b\u0430\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430, \u0438 \u043d\u0430 \u0434\u043e\u043b\u0433\u0438\u0445 \u0434\u0432\u0430 \u043c\u0435\u0441\u044f\u0446\u0430 \u044f \u0437\u0430\u0431\u0440\u043e\u0441\u0438\u043b \u043f\u0440\u043e\u0435\u043a\u0442&#8230;<\/p>\n<p>\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a PG 13 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u044f\u043d\u0432\u0430\u0440\u044f 2021. \u0418 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0448\u0435\u0434\u0448\u0435\u0435 \u043c\u0438\u043d\u043e\u0440\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 <a href=\"https:\/\/www.postgresql.org\/docs\/release\/13.1\/\" rel=\"noopener noreferrer nofollow\">13.1<\/a>. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0431\u0435 \u043c\u043e\u0451 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0434\u043e\u0441\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0448\u043b\u0438. \u041d\u0430 13.1 \u043e\u0446\u0435\u043d\u043a\u0430 bloat&#8217;\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0441\u043d\u043e\u0432\u0430 \u0441\u0442\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e!<\/p>\n<p><strong>\u041c\u043e\u0440\u0430\u043b\u044c \u044d\u0442\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438<\/strong> \u043f\u0440\u043e\u0441\u0442\u0430 \u0438 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u0430: \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0442\u0430\u0449\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043b\u044e\u0431\u0438\u043c\u043e\u0439 \u0421\u0423\u0411\u0414 \u0441\u0440\u0430\u0437\u0443 \u0432 production. \u041e\u0448\u0438\u0431\u043a\u0438 \u0431\u044b\u0432\u0430\u044e\u0442 \u0432\u0435\u0437\u0434\u0435. \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c. \u041d\u0443 \u0430 \u043b\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u0441\u0442\u0430\u043b\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u043e\u0451 \u0434\u0435\u0442\u0438\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f acceptance testing (\u0432\u0435\u0440\u043d\u0435\u0435, \u043a\u0430\u043a \u0435\u0433\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c).<\/p>\n<hr>\n<p>\u0410 \u0447\u0442\u043e \u0442\u0430\u043c \u0441\u043e \u0441\u0436\u0430\u0442\u0438\u0435\u043c \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0432 b-tree, \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0432\u044b? \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043e\u043d\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 null value \u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0445?.. \u0423\u0432\u044b, \u043d\u0435\u0442.<\/p>\n<p>\u0421\u0436\u0430\u0442\u0438\u0435 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e, \u0434\u0430\u0436\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. <a href=\"https:\/\/github.com\/mfvanek\/useful-sql-scripts\/tree\/master\/deduplication_of_btree_indexes_demo\" rel=\"noopener noreferrer nofollow\">\u041f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0411\u0414 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0421\u0423\u0411\u0414 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>Init-db \u0441\u043a\u0440\u0438\u043f\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"sql\">create table if not exists test (   id bigserial primary key,   fld varchar(255),   mark varchar(255),   nil varchar(255) );  insert into test select data.id, case when data.id % 2 = 0 then now()::text else null end, case when data.id % 2 = 0 then 'test_string'::text else null end, null from generate_series(1, 100000) as data(id);  create index if not exists i_test_fld_with_nulls on test (fld); create index if not exists i_test_fld_without_nulls on test (fld) where fld is not null; create index if not exists i_test_mark_with_nulls on test (mark); create index if not exists i_test_mark_without_nulls on test (mark) where mark is not null; create index if not exists i_test_nil_with_nulls on test (nil); create index if not exists i_test_nil_without_nulls on test (nil) where nil is not null;<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432 Docker<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">docker run --name postgres-13 -e POSTGRES_USER=testuser -e POSTGRES_PASSWORD=testpwd -e POSTGRES_DB=testdb -d -p 5432:5432 -v \/absolute\/path\/to\/initdb.sql:\/docker-entrypoint-initdb.d\/initdb.sql postgres:13.2  docker run --name postgres-12 -e POSTGRES_USER=testuser -e POSTGRES_PASSWORD=testpwd -e POSTGRES_DB=testdb -d -p 6432:5432 -v \/absolute\/path\/to\/initdb.sql:\/docker-entrypoint-initdb.d\/initdb.sql postgres:12.6<\/code><\/pre>\n<pre><code class=\"bash\">psql -U testuser -d testdb<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>SQL \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"sql\">select &nbsp; x.indrelid::regclass as table_name, &nbsp; x.indexrelid::regclass as index_name, &nbsp; pg_size_pretty(pg_relation_size(x.indexrelid)) as index_size from pg_index x join pg_stat_all_indexes psai on x.indexrelid = psai.indexrelid and psai.schemaname = 'public' order by 1,2;<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<details class=\"spoiler\">\n<summary>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0432\u0438\u0434\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>PostgreSQL 12<\/strong><\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"center\"><strong>table_name<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>index_name<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>index_size<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>test_pkey<\/p>\n<\/td>\n<td>\n<p>2208 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_fld_with_nulls<\/p>\n<\/td>\n<td>\n<p>3552 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_fld_without_nulls<\/p>\n<\/td>\n<td>\n<p>2456 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_mark_with_nulls<\/p>\n<\/td>\n<td>\n<p>2664 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_mark_without_nulls<\/p>\n<\/td>\n<td>\n<p>1568 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_nil_with_nulls<\/p>\n<\/td>\n<td>\n<p>2224 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_nil_without_nulls<\/p>\n<\/td>\n<td>\n<p>8192 bytes<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>PostgreSQL 13<\/strong><\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"center\"><strong>table_name<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>index_name<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>index_size<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>test_pkey<\/p>\n<\/td>\n<td>\n<p>2208 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_fld_with_nulls<\/p>\n<\/td>\n<td>\n<p>704 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_fld_without_nulls<\/p>\n<\/td>\n<td>\n<p>368 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_mark_with_nulls<\/p>\n<\/td>\n<td>\n<p>696 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_mark_without_nulls<\/p>\n<\/td>\n<td>\n<p>360 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_nil_with_nulls<\/p>\n<\/td>\n<td>\n<p>696 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_nil_without_nulls<\/p>\n<\/td>\n<td>\n<p>8192 bytes<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443, \u0433\u0434\u0435 \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b, \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f.<\/p>\n<\/div>\n<\/details>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/342\/546\/62a\/34254662afd49bedc7e601772a3cf726.png\" alt=\"\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0436\u0430\u0442\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432\" title=\"\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0436\u0430\u0442\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432\" width=\"2526\" height=\"1264\"><figcaption>\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0436\u0430\u0442\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432<\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c null value \u0438\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043a\u0440\u0430\u0439\u043d\u0435 \u0432\u044b\u0433\u043e\u0434\u043d\u043e, \u0438 \u044d\u0442\u043e\u0439 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u043e\u0439 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0435\u043d\u0435\u0431\u0440\u0435\u0433\u0430\u0442\u044c.<\/p>\n<hr>\n<p>\u041d\u0443 \u0438 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a. Embedded PG \u0443\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0435. \u0421\u0435\u0439\u0447\u0430\u0441 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 Testcontainers.<\/p>\n<\/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\/post\/549320\/\"> https:\/\/habr.com\/ru\/post\/549320\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442 \u0425\u0430\u0431\u0440!<\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043c\u0435\u0441\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 PostgreSQL \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/habr.com\/ru\/post\/490824\/\" rel=\"noopener noreferrer nofollow\">pg-index-health<\/a>. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0437\u0430\u0440\u0435\u043b\u0438\u0437\u0438\u043b \u0432\u0435\u0440\u0441\u0438\u044e <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/releases\/tag\/v0.3.1\" rel=\"noopener noreferrer nofollow\">0.3.1<\/a>, \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u043b\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 <a href=\"https:\/\/www.postgresql.org\/about\/news\/postgresql-13-released-2077\/\" rel=\"noopener noreferrer nofollow\">PostgreSQL 13<\/a>.<\/p>\n<p>\u042d\u0442\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u0430\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0430\u0432\u043d\u043e, \u0435\u0449\u0451 \u0432 \u043e\u043a\u0442\u044f\u0431\u0440\u0435 2020. \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 embedded \u0432\u0435\u0440\u0441\u0438\u0438 \u0421\u0423\u0411\u0414 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445, \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 Testcontainers, \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0432 PG13 \u0438 \u0434\u0430\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0435 \u0441 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u041f\u043e\u0441\u0442\u0433\u0440\u0435\u0441\u0430&#8230; \u041d\u043e \u043e\u0431\u043e \u0432\u0441\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b embedded PostgreSQL. \u042f \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043e\u0431 \u044d\u0442\u043e\u043c <a href=\"https:\/\/habr.com\/ru\/post\/501454\/\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u043d\u0435\u0435<\/a>. \u0412 \u0446\u0435\u043b\u043e\u043c \u044d\u0442\u043e \u0431\u044b\u043b \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043d\u043e \u043e\u043d \u0437\u0430\u0432\u044f\u0437\u0430\u043d \u043d\u0430 \u0447\u0443\u0436\u0438\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0438 \u0438 \u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u0410\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u0430 \u0441 13-\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u0431\u044b\u043b\u043e (\u0437\u0430\u0440\u0435\u043b\u0438\u0437\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/mvnrepository.com\/artifact\/io.zonky.test.postgres\/embedded-postgres-binaries-bom\/13.0.0\" rel=\"noopener noreferrer nofollow\">13 \u043d\u043e\u044f\u0431\u0440\u044f<\/a>, \u0441\u043f\u0443\u0441\u0442\u044f \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u043c\u0435\u0441\u044f\u0446\u0430 \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u043e\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432). \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u0436\u0438\u0442\u044c \u0441 \u0442\u0430\u043a\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0431\u044b\u043b\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e.<\/p>\n<p>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0442\u043e\u0436\u0435 \u0431\u044b\u043b \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d \u2013 <a href=\"https:\/\/www.testcontainers.org\/\" rel=\"noopener noreferrer nofollow\">Testcontainers<\/a> (\u0441\u043f\u0430\u0441\u0438\u0431\u043e \u041d\u0438\u043a\u043e\u043b\u0430\u044e \u041a\u043e\u043d\u0434\u0440\u0430\u0442\u044c\u0435\u0432\u0443 \u0437\u0430 \u0432\u0441\u044e <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/pull\/47\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443<\/a>), \u043d\u043e \u043c\u043d\u0435 \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Testcontainers \u2014 \u044d\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u043b\u0441\u0442\u044b\u0439 \u0441\u043b\u043e\u0439 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u0431\u0430\u0437\u043e\u0439, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u043e\u0439 \u0432 Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435. \u041d\u0430 MacOS \u0438 Windows \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f. \u0418 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u044d\u0442\u0438\u043c. \u0414\u0432\u0430\u0436\u0434\u044b. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 <a href=\"https:\/\/github.com\/testcontainers\/testcontainers-java\/issues\/3166\" rel=\"noopener noreferrer nofollow\">\u043d\u0430 MacOS<\/a>, \u0437\u0430\u0442\u0435\u043c <a href=\"https:\/\/github.com\/testcontainers\/testcontainers-java\/issues\/3493\" rel=\"noopener noreferrer nofollow\">\u043d\u0430 Windows<\/a>.<\/p>\n<p>\u041d\u043e \u0447\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0435\u0447\u0430\u043b\u044c\u043d\u043e, \u0432 Github Actions \u0442\u0435\u0441\u0442\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Testcontainers \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Ubuntu. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0434\u043b\u044f Windows \u0438 MacOS. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0441\u0432\u044f\u0437\u043a\u0443, \u0431\u0443\u0434\u0443 \u043f\u0440\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d \u0437\u0430 \u0441\u043e\u0432\u0435\u0442.<\/p>\n<p>\u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u0432 \u043c\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0430 Testcontainers \u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0438 \u043d\u0430 11-\u0439 \u0438 12-\u0439 \u0432\u0435\u0440\u0441\u0438\u044f\u0445. \u0417\u0430\u0442\u0435\u043c \u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u0432\u0430\u043d\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u0441 13.0&#8230; \u0418 \u0442\u0443\u0442 \u043c\u0435\u043d\u044f \u0436\u0434\u0430\u043b \u043e\u0431\u043b\u043e\u043c&#8230; \u0422\u0435\u0441\u0442\u044b \u043d\u0430 \u043e\u0446\u0435\u043d\u043a\u0443 bloat&#8217;\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0443\u043f\u0430\u043b\u0438. <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/tree\/demo\/postgresql-13-bug\" rel=\"noopener noreferrer nofollow\">\u0412 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0442\u043a\u0435<\/a> \u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<figure class=\"full-width\"><figcaption>\u041e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u043d\u0430 PostgreSQL 13.0<\/figcaption><\/figure>\n<p>\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0430\u043b. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b \u043b\u043e\u043c\u0430\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 12-\u0439 \u0438 13-\u0439 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e. \u0423\u0433\u043b\u0443\u0431\u043b\u0451\u043d\u043d\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 <a href=\"https:\/\/www.postgresql.org\/docs\/release\/13.0\/\" rel=\"noopener noreferrer nofollow\">release notes<\/a> \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u043e \u043c\u0435\u043d\u044f \u0441\u043e \u0441\u0436\u0430\u0442\u0438\u0435\u043c \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0432 b-tree \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0445 \u0432 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 &#8212; \u0444\u0438\u0447\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0440\u0430\u043d\u0435\u0435 \u043a\u0430\u043a-\u0442\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u043f\u0443\u0441\u0442\u0438\u043b (\u0434\u0430, \u0442\u0430\u043a \u0442\u043e\u0436\u0435 \u0431\u044b\u0432\u0430\u0435\u0442).<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0441\u0442\u0430\u043b\u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0438\u0437\u043c\u0435\u043d\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f (\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043d\u0435\u0442 &#8212; \u043d\u0430 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b PostgreSQL \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u0431\u044b\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0441\u0438\u043b). \u041d\u043e \u0432\u043e\u0442 &#171;\u0431\u0430\u0433 \u044d\u0442\u043e \u0438\u043b\u0438 \u0444\u0438\u0447\u0430&#187; \u0438 \u043a\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c bloat \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u044f \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043b. \u0412 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u0445 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p>\u0418 \u0442\u043e\u0433\u0434\u0430 \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0441\u043e\u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u043f\u043e \u0441\u0436\u0430\u0442\u0438\u044e \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0432 b-tree \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0445 &#8212; <a href=\"https:\/\/postgrespro.ru\/blog\/pgsql\/5129505\" rel=\"noopener noreferrer nofollow\">\u0410\u043d\u0430\u0441\u0442\u0430\u0441\u0438\u0438 \u041b\u0443\u0431\u0435\u043d\u043d\u0438\u043a\u043e\u0432\u043e\u0439<\/a>. \u0418\u2026 \u043d\u0435\u0442, \u0437\u0434\u0435\u0441\u044c happy end&#8217;\u0430 \u043d\u0435 \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c: \u0443 \u0410\u043d\u0430\u0441\u0442\u0430\u0441\u0438\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0430 \u043f\u043e\u0442\u043e\u043c \u043d\u0430\u0432\u0430\u043b\u0438\u043b\u0430\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430, \u0438 \u043d\u0430 \u0434\u043e\u043b\u0433\u0438\u0445 \u0434\u0432\u0430 \u043c\u0435\u0441\u044f\u0446\u0430 \u044f \u0437\u0430\u0431\u0440\u043e\u0441\u0438\u043b \u043f\u0440\u043e\u0435\u043a\u0442&#8230;<\/p>\n<p>\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a PG 13 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u044f\u043d\u0432\u0430\u0440\u044f 2021. \u0418 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0448\u0435\u0434\u0448\u0435\u0435 \u043c\u0438\u043d\u043e\u0440\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 <a href=\"https:\/\/www.postgresql.org\/docs\/release\/13.1\/\" rel=\"noopener noreferrer nofollow\">13.1<\/a>. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0431\u0435 \u043c\u043e\u0451 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0434\u043e\u0441\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0448\u043b\u0438. \u041d\u0430 13.1 \u043e\u0446\u0435\u043d\u043a\u0430 bloat&#8217;\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0441\u043d\u043e\u0432\u0430 \u0441\u0442\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e!<\/p>\n<p><strong>\u041c\u043e\u0440\u0430\u043b\u044c \u044d\u0442\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438<\/strong> \u043f\u0440\u043e\u0441\u0442\u0430 \u0438 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u0430: \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0442\u0430\u0449\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043b\u044e\u0431\u0438\u043c\u043e\u0439 \u0421\u0423\u0411\u0414 \u0441\u0440\u0430\u0437\u0443 \u0432 production. \u041e\u0448\u0438\u0431\u043a\u0438 \u0431\u044b\u0432\u0430\u044e\u0442 \u0432\u0435\u0437\u0434\u0435. \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c. \u041d\u0443 \u0430 \u043b\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u0441\u0442\u0430\u043b\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u043e\u0451 \u0434\u0435\u0442\u0438\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f acceptance testing (\u0432\u0435\u0440\u043d\u0435\u0435, \u043a\u0430\u043a \u0435\u0433\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c).<\/p>\n<hr>\n<p>\u0410 \u0447\u0442\u043e \u0442\u0430\u043c \u0441\u043e \u0441\u0436\u0430\u0442\u0438\u0435\u043c \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0432 b-tree, \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0432\u044b? \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043e\u043d\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 null value \u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0445?.. \u0423\u0432\u044b, \u043d\u0435\u0442.<\/p>\n<p>\u0421\u0436\u0430\u0442\u0438\u0435 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e, \u0434\u0430\u0436\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. <a href=\"https:\/\/github.com\/mfvanek\/useful-sql-scripts\/tree\/master\/deduplication_of_btree_indexes_demo\" rel=\"noopener noreferrer nofollow\">\u041f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0411\u0414 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0421\u0423\u0411\u0414 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>Init-db \u0441\u043a\u0440\u0438\u043f\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"sql\">create table if not exists test (   id bigserial primary key,   fld varchar(255),   mark varchar(255),   nil varchar(255) );  insert into test select data.id, case when data.id % 2 = 0 then now()::text else null end, case when data.id % 2 = 0 then 'test_string'::text else null end, null from generate_series(1, 100000) as data(id);  create index if not exists i_test_fld_with_nulls on test (fld); create index if not exists i_test_fld_without_nulls on test (fld) where fld is not null; create index if not exists i_test_mark_with_nulls on test (mark); create index if not exists i_test_mark_without_nulls on test (mark) where mark is not null; create index if not exists i_test_nil_with_nulls on test (nil); create index if not exists i_test_nil_without_nulls on test (nil) where nil is not null;<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432 Docker<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">docker run --name postgres-13 -e POSTGRES_USER=testuser -e POSTGRES_PASSWORD=testpwd -e POSTGRES_DB=testdb -d -p 5432:5432 -v \/absolute\/path\/to\/initdb.sql:\/docker-entrypoint-initdb.d\/initdb.sql postgres:13.2  docker run --name postgres-12 -e POSTGRES_USER=testuser -e POSTGRES_PASSWORD=testpwd -e POSTGRES_DB=testdb -d -p 6432:5432 -v \/absolute\/path\/to\/initdb.sql:\/docker-entrypoint-initdb.d\/initdb.sql postgres:12.6<\/code><\/pre>\n<pre><code class=\"bash\">psql -U testuser -d testdb<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>SQL \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"sql\">select &nbsp; x.indrelid::regclass as table_name, &nbsp; x.indexrelid::regclass as index_name, &nbsp; pg_size_pretty(pg_relation_size(x.indexrelid)) as index_size from pg_index x join pg_stat_all_indexes psai on x.indexrelid = psai.indexrelid and psai.schemaname = 'public' order by 1,2;<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<details class=\"spoiler\">\n<summary>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0432\u0438\u0434\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>PostgreSQL 12<\/strong><\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"center\"><strong>table_name<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>index_name<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>index_size<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>test_pkey<\/p>\n<\/td>\n<td>\n<p>2208 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_fld_with_nulls<\/p>\n<\/td>\n<td>\n<p>3552 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_fld_without_nulls<\/p>\n<\/td>\n<td>\n<p>2456 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_mark_with_nulls<\/p>\n<\/td>\n<td>\n<p>2664 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_mark_without_nulls<\/p>\n<\/td>\n<td>\n<p>1568 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_nil_with_nulls<\/p>\n<\/td>\n<td>\n<p>2224 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_nil_without_nulls<\/p>\n<\/td>\n<td>\n<p>8192 bytes<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>PostgreSQL 13<\/strong><\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"center\"><strong>table_name<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>index_name<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong>index_size<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>test_pkey<\/p>\n<\/td>\n<td>\n<p>2208 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_fld_with_nulls<\/p>\n<\/td>\n<td>\n<p>704 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_fld_without_nulls<\/p>\n<\/td>\n<td>\n<p>368 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_mark_with_nulls<\/p>\n<\/td>\n<td>\n<p>696 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_mark_without_nulls<\/p>\n<\/td>\n<td>\n<p>360 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_nil_with_nulls<\/p>\n<\/td>\n<td>\n<p>696 kB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>test<\/p>\n<\/td>\n<td>\n<p>i_test_nil_without_nulls<\/p>\n<\/td>\n<td>\n<p>8192 bytes<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443, \u0433\u0434\u0435 \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b, \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f.<\/p>\n<\/div>\n<\/details>\n<figure class=\"full-width\"><figcaption>\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0436\u0430\u0442\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432<\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c null value \u0438\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043a\u0440\u0430\u0439\u043d\u0435 \u0432\u044b\u0433\u043e\u0434\u043d\u043e, \u0438 \u044d\u0442\u043e\u0439 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u043e\u0439 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0435\u043d\u0435\u0431\u0440\u0435\u0433\u0430\u0442\u044c.<\/p>\n<hr>\n<p>\u041d\u0443 \u0438 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a. Embedded PG \u0443\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0435. \u0421\u0435\u0439\u0447\u0430\u0441 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 Testcontainers.<\/p>\n<\/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\/post\/549320\/\"> https:\/\/habr.com\/ru\/post\/549320\/<\/a><br \/><\/br><\/br><\/hr>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-320486","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320486","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=320486"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320486\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}