{"id":444135,"date":"2025-01-06T03:01:07","date_gmt":"2025-01-06T03:01:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=444135"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2025-01-06T03:01:07","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=444135","title":{"rendered":"<span>pg-index-health \u2013 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b PostgreSQL \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>\u0421 2019 \u0433\u043e\u0434\u0430 \u044f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 open source \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\" rel=\"noopener noreferrer nofollow\">pg-index-health<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0411\u0414 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0412 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0432\u043e\u0438\u0445 <a href=\"https:\/\/habr.com\/ru\/articles\/490824\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439<\/a> \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442.<\/p>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u0433\u043e\u0434\u044b <strong>pg-index-health<\/strong> \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0438 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u043b\u0441\u044f. \u0417\u0430 2024 \u0433\u043e\u0434 \u043c\u043d\u0435 \u043f\u0440\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/graphs\/contributors?from=12%2F30%2F2023\" rel=\"noopener noreferrer nofollow\">\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u043e\u0440\u043e\u0432<\/a> \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0435\u0448\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043e\u0441\u0442\u0430\u0432\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u00ab\u0434\u0435\u0442\u0441\u043a\u0438\u0445 \u0431\u043e\u043b\u044f\u0447\u0435\u043a\u00bb \u0438 \u0434\u043e\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0433\u043e\u0442\u043e\u0432 \u043a \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u0430\u043d\u0441\u0438\u0438.<\/p>\n<h2>\u0420\u043e\u0441\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u0440\u0438\u0445\u043e\u0434\u043e\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/h2>\n<p>\u0421 PostgreSQL \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0441 2015-\u0433\u043e \u0433\u043e\u0434\u0430, \u0438 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0432 \u044f\u0440\u043e\u0441\u043b\u0430\u0432\u0441\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 <a href=\"https:\/\/habr.com\/ru\/companies\/tensor\/articles\/\" rel=\"noopener noreferrer nofollow\">\u0422\u0435\u043d\u0437\u043e\u0440<\/a>.<\/p>\n<p>2015-\u0439 \u0433\u043e\u0434 \u2014 \u044d\u0442\u043e \u0435\u0449\u0451 \u0431\u044b\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043e\u0432 \u0441 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0442\u0430\u0431\u043b\u0438\u0446. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043b\u044e\u0431\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0442\u0430\u043a\u0438\u0445 \u0411\u0414 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u0438\u043b\u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u043b\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0435\u043c \u0437\u043d\u0430\u043d\u0438\u0439. \u042d\u0442\u043e \u0437\u0430\u0449\u0438\u0449\u0430\u043b\u043e \u043e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043e\u0448\u0438\u0431\u043e\u043a, \u043d\u043e \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p>\u041f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043b\u044e\u0434\u0438 \u0441\u0442\u0430\u043b\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0440\u043e\u0441\u043b\u043e, \u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u0441\u0430\u043c\u0438\u0445 \u0431\u0430\u0437\u0430\u0445, \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0441\u043d\u0438\u0437\u0438\u043b\u043e\u0441\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u0442\u0430\u043b\u0430 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0441\u0432\u043e\u0435\u0439 \u0411\u0414. \u041f\u0440\u043e\u043f\u0430\u043b \u0435\u0434\u0438\u043d\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u0438\u0437\u044b, \u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0411\u0414 \u0441\u0442\u0430\u043b\u0438 \u043c\u043d\u043e\u0436\u0438\u0442\u044c\u0441\u044f \u0438 \u0442\u0438\u0440\u0430\u0436\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439.<\/p>\n<h2>\u041f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0435\u0451 \u0444\u043e\u0440\u043c\u044b<\/h2>\n<p>\u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u0432\u0430\u0441, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043f\u0440\u043e \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043b\u044f \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043e\u0432 \u043e\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0439 \u0432\u0438\u0434 \u0441 \u0448\u0438\u0440\u043e\u043a\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u0437 unit-\u0442\u0435\u0441\u0442\u043e\u0432. \u0417\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/martinfowler.com\/articles\/practical-test-pyramid.html\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435 \u041c\u0430\u0440\u0442\u0438\u043d\u0430 \u0424\u0430\u0443\u043b\u0435\u0440\u0430<\/a>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/22f\/bbb\/e26\/22fbbbe26d37afa80e00f32b6110ead6.png\" alt=\"\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\" title=\"\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\" width=\"1290\" height=\"1209\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/22f\/bbb\/e26\/22fbbbe26d37afa80e00f32b6110ead6.png\"\/><\/p>\n<div><figcaption>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u041c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u043d\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (Docker, Testcontainers). \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u0438 \u043d\u0435 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0432\u043e\u0432\u0441\u0435. \u041e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 <a href=\"https:\/\/martinfowler.com\/articles\/2021-test-shapes.html\" rel=\"noopener noreferrer nofollow\">\u0438\u043c\u0435\u0442\u044c \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u0443\u044e \u0444\u043e\u0440\u043c\u0443<\/a>. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u2014 \u044d\u0442\u043e <a href=\"https:\/\/engineering.atspotify.com\/2018\/01\/testing-of-microservices\/\" rel=\"noopener noreferrer nofollow\">Honeycomb<\/a> \u0438 Testing Trophy.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e63\/44b\/e44\/e6344be443d71344757d9fa55514f264.png\" alt=\"\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\" title=\"\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\" width=\"2048\" height=\"1202\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e63\/44b\/e44\/e6344be443d71344757d9fa55514f264.png\"\/><\/p>\n<div><figcaption>\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 unit-\u0442\u0435\u0441\u0442\u043e\u0432, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043d\u044b\u0445 \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0445 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u0443\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c.<\/p>\n<p>\u041c\u043e\u0439 \u043b\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0432\u043e\u0440\u0438\u0442 \u2014 \u044d\u0442\u043e <a href=\"https:\/\/kentcdodds.com\/blog\/the-testing-trophy-and-testing-classifications\" rel=\"noopener noreferrer nofollow\">Testing Trophy<\/a>. \u0412 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0430\u043a\u043e\u0439 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043b\u0435\u0436\u0438\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0437\u0432\u0430\u043d \u0437\u0430\u0449\u0438\u0449\u0430\u0442\u044c \u043e\u0442 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<h2>\u041e \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430<\/h2>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437 Java \u0438 Kotlin \u043a\u043e\u0434\u0430 \u0435\u0441\u0442\u044c \u0443\u0436\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443 \u0432\u0441\u0435\u0445. \u0412 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 \u043d\u0430 Kotlin, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/detekt\/detekt\" rel=\"noopener noreferrer nofollow\">detekt<\/a>. \u0414\u043b\u044f Java \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u0438\u0445 \u0435\u0449\u0451 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 <a href=\"https:\/\/www.sonarsource.com\/learn\/linter\/\" rel=\"noopener noreferrer nofollow\">\u043b\u0438\u043d\u0442\u0435\u0440\u0430\u043c\u0438<\/a>) \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0438\u0440\u0435. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u0442\u043e <strong>checkstyle<\/strong>, <strong>PMD<\/strong>, <strong>SpotBugs<\/strong> \u0438 <strong>Error Prone<\/strong>. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/habr.com\/ru\/articles\/680018\/\" rel=\"noopener noreferrer nofollow\">\u0432 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043d\u0430 \u0425\u0430\u0431\u0440\u0435. \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e <strong>detekt<\/strong> \u0438 <strong>checkstyle<\/strong> \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0447\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u044f\u0442 \u0437\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u0434\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <a href=\"https:\/\/github.com\/readme\/guides\/formatters-linters-compilers\" rel=\"noopener noreferrer nofollow\">formatter\u2019\u0430<\/a>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0442\u043e \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u043c\u0438\u043c\u043e \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0411\u0414.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0432 Java \u043c\u0438\u0440\u0435 \u2014 \u044d\u0442\u043e <strong>Liquibase<\/strong> \u0438 <strong>Flyway<\/strong>. \u041b\u044e\u0431\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0411\u0414 \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u0445. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430 production, \u0442\u043e \u043f\u043e\u0437\u0434\u043d\u0435\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0432\u0441\u0435\u0445 \u0441\u0442\u0435\u043d\u0434\u0430\u0445.<\/p>\n<p>\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c SQL \u2014 \u044d\u0442\u043e \u0434\u0430\u0451\u0442 \u0432\u0430\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 XML-\u0434\u0438\u0430\u043b\u0435\u043a\u0442\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 (\u0440\u0435\u0447\u044c \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u043e <strong>Liquibase<\/strong>). \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u044f \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u043e\u0431 \u044d\u0442\u043e\u043c <a href=\"https:\/\/habr.com\/ru\/articles\/501454\/\" rel=\"noopener noreferrer nofollow\">\u0432 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 SQL \u043a\u043e\u0434\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/sqlfluff.com\/\" rel=\"noopener noreferrer nofollow\">SQLFluff <\/a>(\u043f\u043e \u0441\u0443\u0442\u0438, \u044d\u0442\u043e \u0430\u043d\u0430\u043b\u043e\u0433 <strong>checkstyle<\/strong>). \u042d\u0442\u043e\u0442 \u043b\u0438\u043d\u0442\u0435\u0440 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445\/\u0434\u0438\u0430\u043b\u0435\u043a\u0442\u043e\u0432 (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 PostgreSQL) \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0432 \u0432\u0430\u0448 CI-\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d. \u041e\u043d \u0438\u043c\u0435\u0435\u0442 <a href=\"https:\/\/docs.sqlfluff.com\/en\/stable\/reference\/rules.html\" rel=\"noopener noreferrer nofollow\">\u0441\u0432\u044b\u0448\u0435 60-\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0434 \u0441\u0435\u0431\u044f. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u0430\u043c\u0438 (\u0430\u043b\u0438\u0430\u0441\u0430\u043c\u0438\/aliases) \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u043c SQL-\u043a\u043e\u043c\u0430\u043d\u0434, \u043e\u0442\u0441\u0442\u0443\u043f\u0430\u043c\u0438, \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0438 \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0432\u0435\u0449\u0430\u043c\u0438. \u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e:<\/p>\n<pre><code class=\"sql\">-- \u0441\u043e \u0441\u0442\u0440\u043e\u0433\u0438\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c select     pc.oid::regclass::text as table_name,     pg_table_size(pc.oid) as table_size from     pg_catalog.pg_class pc     inner join pg_catalog.pg_namespace nsp on nsp.oid = pc.relnamespace where     pc.relkind = 'r' and     pc.oid not in (         select c.conrelid as table_oid         from pg_catalog.pg_constraint c         where c.contype = 'p'     ) and     nsp.nspname = :schema_name_param::text order by table_name;<\/code><\/pre>\n<pre><code class=\"sql\">-- \u0431\u0435\u0437 \u0441\u0442\u0440\u043e\u0433\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f SELECT pc.oid::regclass::text AS table_name, pg_table_size(pc.oid) AS table_size FROM pg_catalog.pg_class  pc JOIN pg_catalog.pg_namespace AS nsp ON nsp.oid =  pc.relnamespace WHERE pc.relkind = 'r\u2019  and pc.oid NOT in (   select c.conrelid as table_oid   from pg_catalog.pg_constraint   c   where    c.contype = 'p\u2019 ) and nsp.nspname  = :schema_name_param::text ORDER BY  table_name;<\/code><\/pre>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 SQL \u043a\u043e\u0434 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0435\u0433\u0447\u0435 \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c. \u0418 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u043d\u0430 code review \u0432\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u0442\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0432\u043a\u0443\u0441\u043e\u0432\u0449\u0438\u043d\u044b. <strong>SQLFluff<\/strong> \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 SQL \u043a\u043e\u0434 \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0443. \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c pull request\u2019\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e29\/b6d\/2b9\/e29b6d2b9abdfc1a272f43edf303f294.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f SQLFluff\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f SQLFluff\" width=\"1099\" height=\"948\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e29\/b6d\/2b9\/e29b6d2b9abdfc1a272f43edf303f294.png\"\/><\/p>\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>SQLFluff<\/strong><\/figcaption><\/div>\n<\/figure>\n<p>\u0417\u0434\u0435\u0441\u044c <strong>SQLFluff<\/strong> \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <strong>select<\/strong>: \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u0442\u043e \u043d\u0435 \u0432\u044b\u043d\u043e\u0441\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \u0412\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u2013 \u044d\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u0432\u044b\u0431\u043e\u0440\u043a\u0438: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u0418 \u0442\u0440\u0435\u0442\u044c\u0435 \u2014 \u044d\u0442\u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0434\u043b\u044f <strong>and<\/strong> \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 <strong>join<\/strong>\u2019\u0430: \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043d\u0438\u0436\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435.<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>SQLFluff<\/strong> \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0443 \u043c\u0435\u043d\u044f \u0432 open source \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445: <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health-sql\/blob\/master\/.github\/linters\/.sqlfluff\" rel=\"noopener noreferrer nofollow\">\u043e\u0434\u0438\u043d<\/a>, <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health-demo\/blob\/master\/.github\/linters\/.sqlfluff\" rel=\"noopener noreferrer nofollow\">\u0434\u0432\u0430<\/a>.<\/p>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0411\u0414<\/h2>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u0430\u043c\u043e\u0439 \u0411\u0414 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e: \u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e; \u043d\u043e\u0432\u0430\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0438 \u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435. \u041d\u0430\u0441, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0411\u0414, \u0447\u0435\u043c \u0435\u0451 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>UPM \u043e\u0442 Meta<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/engineering.fb.com\/2022\/11\/30\/data-infrastructure\/static-analysis-sql-queries\/\" rel=\"noopener noreferrer nofollow\">\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c UPM<\/a>\u00a0\u043e\u0442 Meta\/Facebook \u0443\u043c\u0435\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e SQL \u043a\u043e\u0434, \u043d\u043e \u043d\u0435\u044f\u0441\u043d\u043e, \u043c\u043e\u0436\u0435\u0442 \u043b\u0438 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<\/div>\n<\/details>\n<p>PostgreSQL (\u043a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0411\u0414) \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 \u0438 \u0441\u0432\u044f\u0437\u044f\u0445 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u043d\u0430\u0440\u0443\u0436\u0443 \u0432 \u0432\u0438\u0434\u0435 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Information_schema\" rel=\"noopener noreferrer nofollow\">information_schema<\/a>. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a <strong>information_schema<\/strong> \u0434\u043b\u044f \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0439, \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438\u043b\u0438 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a (\u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0435\u0442 <a href=\"https:\/\/github.com\/schemacrawler\/SchemaCrawler\/tree\/v16.24.3\/schemacrawler-postgresql\/src\/main\/resources\/postgresql.information_schema\" rel=\"noopener noreferrer nofollow\">SchemaCrawler<\/a>).<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 PostgreSQL, \u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e <strong>information_schema<\/strong> \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 (\u0441\u0445\u0435\u043c\u0430 <a href=\"https:\/\/www.postgresql.org\/docs\/current\/catalogs.html\" rel=\"noopener noreferrer nofollow\">pg_catalog<\/a>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u044e\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445: \u043a\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0438 \u0442.\u0434. \u0417\u0430 \u0441\u0431\u043e\u0440 \u044d\u0442\u0438\u0445 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 (<a href=\"https:\/\/www.postgresql.org\/docs\/current\/monitoring-stats.html\" rel=\"noopener noreferrer nofollow\">The Cumulative Statistics System<\/a>). \u041e\u0431\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u0438\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health-sql\/blob\/master\/sql\/unused_indexes.sql\" rel=\"noopener noreferrer nofollow\">\u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f<\/a>, \u0438\u043b\u0438 <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health-sql\/blob\/master\/sql\/tables_with_missing_indexes.sql\" rel=\"noopener noreferrer nofollow\">\u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0433\u0434\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442<\/a>.<\/p>\n<p>\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 <a href=\"https:\/\/www.postgresql.org\/docs\/17\/monitoring-stats.html#MONITORING-STATS-FUNCTIONS\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e<\/a>. \u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0431\u0440\u043e\u0441\u0430 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u0412\u0430\u0436\u043d\u043e \u044d\u0442\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 \u0438\u043b\u0438 \u043d\u0435\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0440\u0430\u0437 \u0432 \u043c\u0435\u0441\u044f\u0446\/\u043a\u0432\u0430\u0440\u0442\u0430\u043b\/\u043f\u043e\u043b\u0443\u0433\u043e\u0434\u0438\u0435, \u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0437\u0430 \u043f\u0435\u0440\u0438\u043e\u0434 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0411\u0414, \u0442\u043e \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0438 \u043d\u0435 \u0440\u0435\u043f\u043b\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430.<\/p>\n<h2>pg-index-health \u0438 \u0435\u0433\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430<\/h2>\n<p>\u0418\u0434\u0435\u044f \u0441 \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0411\u0414 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u044b, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432\u044b\u0448\u0435, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043c\u043d\u043e\u0439 \u0432 \u0432\u0438\u0434\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\" rel=\"noopener noreferrer nofollow\">pg-index-health<\/a>.<\/p>\n<p>\u041c\u043e\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u0431\u043e\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0432 \u0432\u0438\u0434\u0435 sql-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0445 <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health-sql\" rel=\"noopener noreferrer nofollow\">\u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a> (\u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044d\u0442\u043e 25 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a). \u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u044b \u043e\u0442 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b \u043d\u0430 Java \u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043c\u0435\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/blob\/f6a4fb0740a14e6c156531fa22a03dad5a84a12b\/pg-index-health-jdbc-connection\/src\/main\/java\/io\/github\/mfvanek\/pg\/connection\/HighAvailabilityPgConnection.java#L22\" rel=\"noopener noreferrer nofollow\">HighAvailabilityPgConnection<\/a> \u043d\u0430\u0434 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043a \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0445\u043e\u0441\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f sql-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>Spring Boot starter \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0432 unit\/\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043d\u044b\u0435\/\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0435 sql-\u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0412\u0438\u0434\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a<\/h2>\n<p>\u0412\u0441\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (\u043e\u043d\u0438 \u0436\u0435 <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/blob\/f6a4fb0740a14e6c156531fa22a03dad5a84a12b\/pg-index-health-core\/src\/main\/java\/io\/github\/mfvanek\/pg\/core\/checks\/common\/Diagnostic.java#L25\" rel=\"noopener noreferrer nofollow\">\u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438<\/a>) \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0435 \u0433\u0440\u0443\u043f\u043f\u044b:<\/p>\n<ul>\n<li>\n<p>runtime \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (\u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438);<\/p>\n<\/li>\n<li>\n<p>\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (\u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438).<\/p>\n<\/li>\n<\/ul>\n<p><strong>Runtime \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438<\/strong> \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u043c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 production. \u042d\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0438 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044e\u0442 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0441\u043e \u0432\u0441\u0435\u0445 \u0445\u043e\u0441\u0442\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0411\u0414 \u0438\u0437 3-\u0445 \u0445\u043e\u0441\u0442\u043e\u0432: primary, secondary \u0438 async replica. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u044b \u0441 \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u0442\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u0435\u0439 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0442\u044f\u0436\u0451\u043b\u044b\u0435 \u0447\u0438\u0442\u0430\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0435 \u0434\u043b\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u041d\u0430 primary \u0445\u043e\u0441\u0442\u0435 \u0442\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 latency \u0434\u0440\u0443\u0433\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0a1\/332\/e64\/0a1332e64c059ac52260a90f08362251.png\" alt=\"\u041a\u043b\u0430\u0441\u0442\u0435\u0440 \u0411\u0414 PostgreSQL\" title=\"\u041a\u043b\u0430\u0441\u0442\u0435\u0440 \u0411\u0414 PostgreSQL\" width=\"2027\" height=\"1207\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0a1\/332\/e64\/0a1332e64c059ac52260a90f08362251.png\"\/><\/p>\n<div><figcaption>\u041a\u043b\u0430\u0441\u0442\u0435\u0440 \u0411\u0414 PostgreSQL<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0440\u0430\u043d\u0435\u0435, \u0432 PostgreSQL \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0438 \u043d\u0435 \u0440\u0435\u043f\u043b\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0443 \u0432\u0430\u0441 \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u0447\u0442\u043e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0438 \u043d\u0443\u0436\u043d\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0435. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0435\u0440\u0434\u0438\u043a\u0442\u0430 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0443\u0436\u0435\u043d \u0438\u043b\u0438 \u043d\u0435\u0442, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b.<\/p>\n<p><strong>\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438<\/strong> \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0430 primary \u0445\u043e\u0441\u0442\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u043a\u0430\u0442\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439. \u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u0438\u0445 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 production \u0431\u0430\u0437\u0435 \u0438 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u041e\u0434\u043d\u0430\u043a\u043e, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435, \u0438 \u043e\u043d\u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0432 \u0442\u0435\u0441\u0442\u0430\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0442\u0438\u043f\u043e\u0432\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7ff\/c20\/a74\/7ffc20a74148214c575aab3998d2a04b.png\" alt=\"\u0418\u043d\u0441\u0442\u0430\u043d\u0441 PostgreSQL \u0432 Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435\" title=\"\u0418\u043d\u0441\u0442\u0430\u043d\u0441 PostgreSQL \u0432 Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435\" width=\"2162\" height=\"1072\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7ff\/c20\/a74\/7ffc20a74148214c575aab3998d2a04b.png\"\/><\/p>\n<div><figcaption>\u0418\u043d\u0441\u0442\u0430\u043d\u0441 PostgreSQL \u0432 Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435<\/figcaption><\/div>\n<\/figure>\n<h2>\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c pg-index-health<\/h2>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>pg-index-health<\/strong> \u2014 \u044d\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0411\u0414 \u0432 \u0432\u0430\u0448 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 Spring Boot \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u0442\u0435\u0440 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"kotlin\">dependencies {     testImplementation(\"io.github.mfvanek:pg-index-health-test-starter:0.14.4\") }<\/code><\/pre>\n<p>\u0418 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0442\u0435\u0441\u0442:<\/p>\n<pre><code class=\"java\">import io.github.mfvanek.pg.core.checks.common.DatabaseCheckOnHost; import io.github.mfvanek.pg.core.checks.common.Diagnostic; import io.github.mfvanek.pg.model.dbobject.DbObject; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles;  import java.util.List;  import static org.assertj.core.api.Assertions.assertThat;  @SpringBootTest @ActiveProfiles(\"test\") class DatabaseStructureStaticAnalysisTest {      @Autowired     private List&lt;DatabaseCheckOnHost&lt;? extends DbObject&gt;&gt; checks;      @Test     void checksShouldWork() {         assertThat(checks)             .hasSameSizeAs(Diagnostic.values());          checks.stream()             .filter(DatabaseCheckOnHost::isStatic)             .forEach(c -&gt; assertThat(c.check())                 .as(c.getDiagnostic().name())                 .isEmpty());     } }<\/code><\/pre>\n<p>\u0412 \u0442\u0435\u0441\u0442\u0435 \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430. \u0417\u0430\u0442\u0435\u043c \u043e\u0442\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u043e\u0439 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u043c\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0412 \u0438\u0434\u0435\u0430\u043b\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e <strong>\u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f<\/strong>, \u0442\u043e \u0442\u0435\u0441\u0442 \u0443\u043f\u0430\u0434\u0451\u0442. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443: \u043b\u0438\u0431\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0451 \u0432 \u0441\u0432\u043e\u0435\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u043b\u0438\u0431\u043e \u044f\u0432\u043d\u043e \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<h2>\u041b\u043e\u0436\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439<\/h2>\n<p>\u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0443 <strong>pg-index-health<\/strong>, \u043a\u0430\u043a \u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u0431\u044b\u0432\u0430\u044e\u0442 \u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f (<strong><em>false positive<\/em><\/strong>). \u0410 \u0435\u0449\u0451 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439 \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0442\u043e\u043d\u0430 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0411\u0414. PostgreSQL \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c <a href=\"https:\/\/www.postgresql.org\/docs\/current\/sql-comment.html\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 <\/a>\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e \u0432\u0441\u0435\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c. \u0412 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"sql\">create table if not exists demo.warehouse (     id bigint primary key generated always as identity,     name varchar(255) not null );  comment on table demo.warehouse is 'Information about the warehouses'; comment on column demo.warehouse.id is 'Unique identifier of the warehouse'; comment on column demo.warehouse.name is 'Human readable name of the warehouse';<\/code><\/pre>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u0441\u0432\u043e\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0448\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442\u0435 \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c. \u0422\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a (<strong>TABLES_WITHOUT_DESCRIPTION<\/strong>, <strong>COLUMNS_WITHOUT_DESCRIPTION<\/strong>, <strong>FUNCTIONS_WITHOUT_DESCRIPTION<\/strong>) \u0434\u043b\u044f \u0432\u0430\u0441 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043d\u0435\u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u043c\u0438.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u0430\u043a \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<pre><code class=\"java\">@Test void checksShouldWork() {     assertThat(checks)         .hasSameSizeAs(Diagnostic.values());      checks.stream()         .filter(DatabaseCheckOnHost::isStatic)         .filter(c -&gt; c.getDiagnostic() != Diagnostic.TABLES_WITHOUT_DESCRIPTION &amp;&amp;             c.getDiagnostic() != Diagnostic.COLUMNS_WITHOUT_DESCRIPTION)         .forEach(c -&gt; assertThat(c.check())             .as(c.getDiagnostic().name())             .isEmpty()); }<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:<\/p>\n<pre><code class=\"java\">@Test void checksShouldWork() {     assertThat(checks)         .hasSameSizeAs(Diagnostic.values());      checks.stream()         .filter(DatabaseCheckOnHost::isStatic)         .forEach(c -&gt; {             final ListAssert&lt;? extends DbObject&gt; listAssert = assertThat(c.check())                 .as(c.getDiagnostic().name());             switch (c.getDiagnostic()) {                 case TABLES_WITHOUT_DESCRIPTION, COLUMNS_WITHOUT_DESCRIPTION -&gt; listAssert.hasSizeGreaterThanOrEqualTo(0); \/\/ ignored                  default -&gt; listAssert.isEmpty();             }         }); }<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0438 <strong>pg-index-health<\/strong> \u0443 \u0432\u0430\u0441 \u0447\u0430\u0441\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0411\u0414 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e <strong>\u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f<\/strong>, \u043d\u043e \u0432\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0445 \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u043b\u044f \u0432\u0430\u0441 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u0430 \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0435\u0451 \u043d\u0435\u043b\u044c\u0437\u044f. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0434\u0435:<\/p>\n<pre><code class=\"java\">@Test void checksShouldWorkForAdditionalSchema() {     final PgContext ctx = PgContext.of(\"additional_schema\");     checks.stream()         .filter(DatabaseCheckOnHost::isStatic)         .forEach(c -&gt; {             final ListAssert&lt;? extends DbObject&gt; listAssert = assertThat(c.check(ctx))                 .as(c.getDiagnostic().name());              switch (c.getDiagnostic()) {                 case TABLES_WITHOUT_DESCRIPTION, TABLES_NOT_LINKED_TO_OTHERS -&gt;                     listAssert.hasSize(1)                         .asInstanceOf(list(Table.class))                         .containsExactly(                             Table.of(ctx, \"additional_table\")                         );                  default -&gt; listAssert.isEmpty();             }         }); }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445.<\/p>\n<h2>\u0422\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0435\u0437 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439<\/h2>\n<p>\u0412 \u0441\u0438\u043b\u0443 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u00a0<a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/442804\/\" rel=\"noopener noreferrer nofollow\">MVCC \u0432 Postgres\u2019\u0435<\/a>\u00a0\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0442\u0430\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u0430\u043a\u00a0<a href=\"https:\/\/habr.com\/ru\/post\/169939\/\" rel=\"noopener noreferrer nofollow\">bloat<\/a>, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u0430\u0448\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (\u0438\u043b\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430) \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0441\u0442\u0451\u0442 \u0437\u0430 \u0441\u0447\u0451\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u0435\u0440\u0442\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437-\u0437\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0434\u043e\u043b\u0433\u0438\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u0438\u043b\u0438 \u0435\u0434\u0438\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<p>\u0417\u0430 \u0441\u0431\u043e\u0440\u043a\u0443 \u043c\u0443\u0441\u043e\u0440\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0411\u0414 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 <a href=\"https:\/\/www.postgresql.org\/docs\/current\/routine-vacuuming.html\" rel=\"noopener noreferrer nofollow\">autovacuum<\/a>, \u043d\u043e \u043e\u043d \u043d\u0435 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u0437\u0430\u043d\u044f\u0442\u043e\u0435 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435. \u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/www.postgresql.org\/docs\/current\/sql-vacuum.html\" rel=\"noopener noreferrer nofollow\">VACUUM FULL<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u044d\u043a\u0441\u043a\u043b\u044e\u0437\u0438\u0432\u043d\u043e\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430 \u0432\u0441\u0451 \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u043e\u0432, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043c\u0430\u043b\u043e\u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u043c \u043f\u043e\u043b\u043d\u043e\u0435 \u0432\u0430\u043a\u0443\u0443\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 bloat\u2019\u043e\u043c \u0442\u0430\u0431\u043b\u0438\u0446 \u0431\u0435\u0437 downtime\u2019\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 <a href=\"https:\/\/github.com\/reorg\/pg_repack\" rel=\"noopener noreferrer nofollow\">pg_repack<\/a>. \u041e\u0434\u043d\u043e \u0438\u0437 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 <strong>pg_repack<\/strong>\u00a0\u2014 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0438\u043b\u0438 \u0438\u043d\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0414\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430 <strong>TABLES_WITHOUT_PRIMARY_KEY<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0435\u0437 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0438\u0445 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0435\u0437 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430. \u0415\u0441\u043b\u0438 \u0432 \u043d\u0435\u0439 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 bloat, \u0442\u043e <strong>pg_repack<\/strong> \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<pre><code class=\"sql\">create table if not exists demo.payment (     id bigint not null, -- \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u043d\u0435 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u043a\u0430\u043a primary key     order_id bigint references demo.orders (id),     status int not null,     created_at timestamp not null,     payment_total decimal(22, 2) not null );<\/code><\/pre>\n<h2>\u0414\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0435\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u044b<\/h2>\n<p>\u041d\u0430\u0448\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430 \u0445\u043e\u0441\u0442\u0430\u0445 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u043c\u0438\/\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438. \u0418 \u043c\u0435\u0441\u0442\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445. \u041e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u0430 Database as a Service \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0411\u0414, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c.<\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u0434\u0438\u0441\u043a\u0435. \u041e\u043d \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043d\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0435, \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0443 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0438\u043b\u0438 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043a\u043e\u0433\u0434\u0430 \u0438\u0445 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0430\u043c\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c, \u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c \u0434\u043b\u044f \u0435\u0451 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u042f \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u0445 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043b\u0438\u0448\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u041f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0435\u0446 <strong><em>id<\/em><\/strong> \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e.<\/p>\n<pre><code class=\"sql\">create table if not exists demo.buyer (     id bigint primary key default nextval('demo.buyer_seq'), -- PK     first_name varchar(255) not null,     last_name varchar(255) not null,     middle_name varchar(255),     phone varchar(20) not null,     email varchar(50) not null,     ip_address varchar(100) );  create unique index if not exists idx_buyer_pk     on demo.buyer (id); -- \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e<\/code><\/pre>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u0442\u0435 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0441\u0442\u043e\u043b\u0431\u0435\u0446 (\u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432) \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c <strong><em>unique<\/em><\/strong>, \u0442\u043e PostgreSQL \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 (\u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432). \u0412\u0440\u0443\u0447\u043d\u0443\u044e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043b\u0438\u0448\u043d\u0438\u0439 \u0434\u0443\u0431\u043b\u044c. \u0422\u0430\u043a\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b-\u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c, \u0438 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430 <strong>DUPLICATED_INDEXES<\/strong> \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432 \u044d\u0442\u043e\u043c.<\/p>\n<pre><code class=\"sql\">create table if not exists demo.order_item (     id bigint primary key default nextval('demo.order_item_seq'),     order_id bigint not null references demo.orders (id),     price decimal(22, 2) not null default 0,     amount int not null default 0,     sku varchar(255) not null,     warehouse_id int not null,     unique (sku, order_id) -- unique constraint  );  create unique index if not exists i_order_item_sku_order_id_unique     on demo.order_item (sku, order_id); -- \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e<\/code><\/pre>\n<h2>\u041f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u044b<\/h2>\n<p>\u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0434\u0438\u043d \u0441\u0442\u043e\u043b\u0431\u0435\u0446. \u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0411\u0414, \u043c\u043e\u0433\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0435 \u0432 \u0441\u0435\u0431\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432. \u0422\u0430\u043a \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u044b A, A+B, A+B+C \u0438 \u0442.\u043f. \u041f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430\u043c\u0438 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e (\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/www.youtube.com\/watch?v=aaecM4wKdhY\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u043b\u0430\u0434<\/a>). \u042d\u0442\u043e \u0442\u043e\u0436\u0435 \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u043c\u0435\u0441\u0442\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430 <strong>INTERSECTED_INDEXES<\/strong>.<\/p>\n<pre><code class=\"sql\">create table if not exists demo.buyer (     id bigint primary key default nextval('demo.buyer_seq'),     first_name varchar(255) not null,     last_name varchar(255) not null,     middle_name varchar(255),     phone varchar(20) not null );  create index if not exists i_buyer_first_name     on demo.buyer (first_name); -- \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c  create index if not exists i_buyer_names     on demo.buyer (first_name, last_name, middle_name);  create index if not exists i_buyer_id_phone     on demo.buyer (id, phone); -- \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043b\u043e\u0445\u0430\u044f \u0437\u0430\u0442\u0435\u044f<\/code><\/pre>\n<h2>\u0412\u043d\u0435\u0448\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0438 \u0431\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432<\/h2>\n<p>Postgres \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c <a href=\"https:\/\/www.postgresql.org\/docs\/current\/ddl-constraints.html#DDL-CONSTRAINTS-FK\" rel=\"noopener noreferrer nofollow\">\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430<\/a> \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0442.\u0435. \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e, \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 \u044d\u0442\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u0438 \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0435\u0431\u044f \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0442\u044c. \u0410 \u0438\u043d\u043e\u0433\u0434\u0430 \u0438\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442 \u0432 production.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 (\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e PostgreSQL 16.6):<\/p>\n<pre><code class=\"sql\">create schema if not exists demo;  create table if not exists demo.orders (     id bigint primary key generated always as identity,     user_id bigint not null,     shop_id bigint not null,     status int not null,     created_at timestamptz not null default current_timestamp );  create table if not exists demo.order_item (     id bigint primary key generated always as identity,     order_id bigint not null references demo.orders (id),     price decimal(22, 2) not null default 0,     amount int not null default 0,     sku varchar(255) not null,     warehouse_id int );<\/code><\/pre>\n<p>\u0415\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0437\u0430\u043a\u0430\u0437\u0430\u043c\u0438 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0442\u043e\u0432\u0430\u0440\u043d\u044b\u043c\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c\u0438 \u0432 \u0437\u0430\u043a\u0430\u0437\u0435. \u041e\u043d\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u0435 <strong><em>order_id<\/em><\/strong>. \u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u0431\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u043b\u0438\u0431\u043e \u043d\u0430 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443. \u0414\u043e\u0431\u0430\u0432\u0438\u043c 100 \u0442\u044b\u0441\u044f\u0447 \u0437\u0430\u043a\u0430\u0437\u043e\u0432. \u0423 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u044b \u0437\u0430\u043a\u0430\u0437\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0430 \u0442\u043e\u0432\u0430\u0440\u0430 \u0432 \u0437\u0430\u043a\u0430\u0437\u0435, \u0443 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u2014 \u043e\u0434\u0438\u043d.<\/p>\n<pre><code class=\"sql\">insert into demo.orders (user_id, shop_id, status)  select     (ids.id % 10) + 1 as user_id,     (ids.id % 4) + 1 as shop_id,     1 as status \u2013 new order from generate_series(1, 100000) ids (id);  insert into demo.order_item (order_id, price, amount, sku) select     id as order_id,     (random() + 1) * 1000.0 as price,     (random() * 10) + 1 as amount,     md5(random()::text) as sku from demo.orders;  insert into demo.order_item (order_id, price, amount, sku) select     id as order_id,     (random() + 1) * 2000.0 as price,     (random() * 5) + 1 as amount,     md5((random() + 1)::text) as sku from demo.orders where id % 2 = 0;  -- \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 vacuum analyze demo.orders, demo.order_item;<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0434\u043b\u044f \u0437\u0430\u043a\u0430\u0437\u0430 \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c <strong><em>100<\/em><\/strong>, \u0442\u043e \u043d\u0430\u043c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u0435\u0440\u043d\u0451\u0442\u0441\u044f 2 \u0441\u0442\u0440\u043e\u043a\u0438. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 <strong><em>id<\/em><\/strong> \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0437\u0430\u043a\u0430\u0437\u043e\u0432 \u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<pre><code class=\"sql\">explain (analyze, buffers) select oi.id, oi.order_id, oi.price, oi.amount, oi.sku, o.user_id, o.shop_id, o.status from demo.orders o join demo.order_item oi on oi.order_id = o.id where o.id = 100 -- \u0435\u0441\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0441\u0442\u043e\u043b\u0431\u0446\u0443 order by oi.id;<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0442\u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Query_plan\" rel=\"noopener noreferrer nofollow\">\u0432 \u043f\u043b\u0430\u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/a> (query plan\/query execution plan) \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u043e\u0440\u043e\u0436\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u2014 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong><em>Buffers<\/em><\/strong>.<\/p>\n<pre><code class=\"sql\">Sort  (cost=3588.34..3588.35 rows=2 width=79) (actual time=25.244..25.248 rows=2 loops=1)   Sort Key: oi.id   Sort Method: quicksort  Memory: 25kB   Buffers: shared hit=1711   -&gt;  Nested Loop  (cost=0.29..3588.33 rows=2 width=79) (actual time=0.083..25.212 rows=2 loops=1)         Buffers: shared hit=1711         -&gt;  Index Scan using orders_pkey on orders o  (cost=0.29..8.31 rows=1 width=28) (actual time=0.040..0.052 rows=1 loops=1)               Index Cond: (id = 100)               Buffers: shared hit=6         -&gt;  Seq Scan on order_item oi  (cost=0.00..3580.00 rows=2 width=59) (actual time=0.036..25.145 rows=2 loops=1)               Filter: (order_id = 100)               Rows Removed by Filter: 149998               Buffers: shared hit=1705 Planning:   Buffers: shared hit=54 Planning Time: 0.793 ms Execution Time: 25.314 ms<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043a\u043b\u044e\u0447\u043e\u043c, \u0442\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"sql\">create index concurrently if not exists idx_order_item_order_id     on demo.order_item (order_id);<\/code><\/pre>\n<p>\u0418\u0437 \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u043e\u043f\u0430\u0434\u0451\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0442\u043e\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u0441\u044f:<\/p>\n<pre><code class=\"sql\">Sort  (cost=19.54..19.55 rows=2 width=79) (actual time=0.110..0.113 rows=2 loops=1)   Sort Key: oi.id   Sort Method: quicksort  Memory: 25kB   Buffers: shared hit=8   -&gt;  Nested Loop  (cost=0.71..19.53 rows=2 width=79) (actual time=0.076..0.086 rows=2 loops=1)         Buffers: shared hit=8         -&gt;  Index Scan using orders_pkey on orders o  (cost=0.29..8.31 rows=1 width=28) (actual time=0.029..0.030 rows=1 loops=1)               Index Cond: (id = 100)               Buffers: shared hit=3         -&gt;  Index Scan using idx_order_item_order_id on order_item oi  (cost=0.42..11.20 rows=2 width=59) (actual time=0.033..0.040 rows=2 loops=1)               Index Cond: (order_id = 100)               Buffers: shared hit=5 Planning:   Buffers: shared hit=15 read=1 Planning Time: 1.065 ms Execution Time: 0.178 ms<\/code><\/pre>\n<p>\u0414\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430 <strong>FOREIGN_KEYS_WITHOUT_INDEX<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0430\u043c \u0443\u0436\u0435 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043a\u0435\u0439\u0441\u044b \u0438 \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438\u043b\u0438 \u043d\u0435\u0442?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e \u0435\u0449\u0451 \u0440\u0430\u0437 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043f\u0440\u043e <strong><em>false positive<\/em><\/strong> \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f: \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438 \u043d\u0435 \u0432\u0441\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043d\u0443\u0436\u043d\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041f\u043e\u0441\u0442\u0430\u0440\u0430\u0439\u0442\u0435\u0441\u044c \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 production; \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432\u0430\u0448 \u043a\u043e\u0434 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438\/\u043f\u043e\u0438\u0441\u043a\u0430\/join\u2019\u043e\u0432 \u043f\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0443 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430 100% \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u0435\u043d, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0435\u0433\u043e \u0432 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d\u044b\/\u0441\u043e\u043c\u043d\u0435\u0432\u0430\u0435\u0442\u0435\u0441\u044c, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0438\u043d\u0434\u0435\u043a\u0441 (\u0435\u0433\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u0437\u0434\u043d\u0435\u0435).<\/p>\n<p>\u042f \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u0430\u043c\u0438, \u043a\u043e\u0433\u0434\u0430 \u0431\u0430\u0437\u0430 \u00ab\u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b\u0430\u00bb \u0438\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447, \u0438 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0431\u0430\u0437\u0430 \u00ab\u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b\u0430\u00bb \u0438\u0437-\u0437\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u044f \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0435\u043d \u0441 \u043f\u043e\u0441\u044b\u043b\u043e\u043c <a href=\"https:\/\/www.percona.com\/blog\/should-i-create-an-index-on-foreign-keys-in-postgresql\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u0431\u043b\u043e\u0433\u0435 Percona<\/a>, \u0447\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435. \u042d\u0442\u043e \u043f\u043e\u0434\u0445\u043e\u0434 DBA. \u0410 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 DBA \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435?<\/p>\n<\/div>\n<\/details>\n<h2>Null value \u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0445<\/h2>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Postgres \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 <strong><em>null<\/em><\/strong> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 btree-\u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u043d\u043e \u043e\u043d\u0438 \u0442\u0430\u043c, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0435 \u043d\u0443\u0436\u043d\u044b. \u0412\u0441\u0435 <strong><em>null<\/em><\/strong> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b, \u0438 \u0432\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u0432\u0437\u044f\u0442\u044c \u0438 \u043d\u0430\u0439\u0442\u0438 \u043e\u0434\u043d\u0443 \u0437\u0430\u043f\u0438\u0441\u044c, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0440\u0430\u0432\u043d\u043e <strong><em>null<\/em><\/strong>. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c null\u2019\u044b \u0438\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u0430 nullable-\u0441\u0442\u043e\u043b\u0431\u0446\u044b \u043f\u043e \u0442\u0438\u043f\u0443 <code>where &lt;A&gt; is not null.<\/code> \u0414\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430 <strong>INDEXES_WITH_NULL_VALUES<\/strong> \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043a\u0435\u0439\u0441\u044b.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0437\u0430\u043a\u0430\u0437\u043e\u0432 \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0432 \u0437\u0430\u043a\u0430\u0437\u0435. \u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <strong>order_item<\/strong> \u0435\u0441\u0442\u044c nullable \u043a\u043e\u043b\u043e\u043d\u043a\u0430 <strong>warehouse_id<\/strong> \u2014 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u043a\u043b\u0430\u0434\u0430.<\/p>\n<pre><code class=\"sql\">create table if not exists demo.order_item (     id bigint primary key generated always as identity,     order_id bigint not null references demo.orders (id),     price decimal(22, 2) not null default 0,     amount int not null default 0,     sku varchar(255) not null,     warehouse_id int );<\/code><\/pre>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u043b\u0430\u0434\u043e\u0432. \u041f\u043e\u0441\u043b\u0435 \u043e\u043f\u043b\u0430\u0442\u044b \u0437\u0430\u043a\u0430\u0437\u0430 \u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u043e\u0432\u0430\u0442\u044c. \u041e\u0431\u043d\u043e\u0432\u0438\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u0443 \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u043a\u0430\u0437\u043e\u0432 \u0438 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0445 \u043e\u043f\u043b\u0430\u0447\u0435\u043d\u043d\u044b\u043c\u0438:<\/p>\n<pre><code class=\"sql\">-- \u0438\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 create index concurrently if not exists idx_orders_creates_at_status on demo.orders (created_at, status);  -- \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 \u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0437\u0430\u043a\u0430\u0437\u043e\u0432 update demo.orders     set status = 2 -- paid order where     status = 1 -- new order     and id in (     select id from demo.orders where id % 4 = 0 order by id limit 100);<\/code><\/pre>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u0437\u0430\u043a\u0430\u0437\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u0441 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043a\u043b\u0430\u0434\u043e\u0432 \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u043a\u0438, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0442\u043e\u0432\u0430\u0440\u0430 \u043d\u0430 \u0441\u043a\u043b\u0430\u0434\u0435, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441\u043a\u043b\u0430\u0434\u0430 \u0438 \u0442.\u0434. \u041d\u0430\u0437\u043d\u0430\u0447\u0438\u0432 \u0441\u043a\u043b\u0430\u0434 \u0438 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0432 \u043e\u0441\u0442\u0430\u0442\u043a\u0438, \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0437\u0430\u043a\u0430\u0437\u0430 \u043c\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0435 <strong>warehouse_id<\/strong> (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0442\u0430\u043c \u0431\u044b\u043b\u043e <strong><em>null<\/em><\/strong>).<\/p>\n<pre><code class=\"sql\">update demo.order_item     set warehouse_id = case when order_id % 8 = 0 then 1 else 2 end where     warehouse_id is null     and order_id in (     select id from demo.orders     where         status = 2         and created_at &gt;= current_timestamp - interval '1 day');<\/code><\/pre>\n<p>\u041d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 \u0441\u043a\u043b\u0430\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u0442\u0433\u0440\u0443\u0437\u0438\u0442\u044c. \u0411\u0435\u0440\u0451\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u043b\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043a\u0430\u0437\u044b \u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438:<\/p>\n<pre><code class=\"sql\">select oi.id, oi.order_id, oi.price, oi.amount, oi.sku, o.user_id, o.shop_id, o.status from demo.orders o join demo.order_item oi on oi.order_id = o.id where     oi.warehouse_id = 2     and o.status = 2     and o.created_at &gt;= current_timestamp - interval '1 day' order by oi.id;<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 <strong>warehouse_id<\/strong>:<\/p>\n<pre><code class=\"sql\">create index concurrently if not exists idx_order_item_warehouse_id     on demo.order_item (warehouse_id);<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441, \u0442\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0431\u0435\u0437 \u043e\u0441\u043e\u0431\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0441\u043a\u043b\u0430\u0434\u0430. \u0418 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0449\u0451 \u043d\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0441\u043a\u043b\u0430\u0434, \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0432 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e <code>warehouse_id is null<\/code>:<\/p>\n<pre><code class=\"sql\">explain (analyze, buffers) select * from demo.order_item where warehouse_id is null;<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u043b\u0430\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c \u0442\u0430\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u2014 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f.<\/p>\n<pre><code class=\"sql\">Seq Scan on order_item  (cost=0.00..3208.00 rows=149755 width=63) (actual time=0.214..24.909 rows=149800 loops=1)   Filter: (warehouse_id IS NULL)   Rows Removed by Filter: 200   Buffers: shared hit=1708 Planning Time: 0.291 ms Execution Time: 33.720 ms<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0411\u0414. \u0421\u0442\u043e\u043b\u0431\u0435\u0446 <strong>warehouse_id<\/strong> \u0438\u043c\u0435\u0435\u0442 \u043d\u0438\u0437\u043a\u0443\u044e <a href=\"https:\/\/sql-ex.ru\/blogs\/?\/Kardinalnoe_chislo_mownost_mnoZhestva.html\" rel=\"noopener noreferrer nofollow\">\u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/a>, \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u043d\u0451\u043c \u043d\u0435\u0432\u0435\u043b\u0438\u043a\u043e. \u0410 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0441\u0442\u043e\u043b\u0431\u0446\u0443 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438\u0437\u043a\u0443\u044e <a href=\"https:\/\/backendinterview.ru\/db\/relational\/mysql\/indexes.html#%D0%A1%D0%B5%D0%BB%D0%B5%D0%BA%D1%82%D0%B8%D0%B2%D0%BD%D0%BE%D1%81%D1%82%D1%8C\" rel=\"noopener noreferrer nofollow\">\u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/a>. \u041f\u043e\u0434 \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u0442\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438) \u043a \u043e\u0431\u0449\u0435\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0441\u0442\u0440\u043e\u043a \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435: distinct \/ count(). \u0422\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438\u043c\u0435\u0435\u0442 \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c, \u0440\u0430\u0432\u043d\u0443\u044e \u0435\u0434\u0438\u043d\u0438\u0446\u0435.<\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0443\u0431\u0440\u0430\u0432 <strong><em>null<\/em><\/strong> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u0437\u0434\u0430\u0432 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 <strong>warehouse_id<\/strong>.<\/p>\n<pre><code class=\"sql\">create index concurrently if not exists idx_order_item_warehouse_id_without_nulls     on demo.order_item (warehouse_id) where warehouse_id is not null;<\/code><\/pre>\n<p>\u041c\u044b \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0443\u0432\u0438\u0434\u0438\u043c \u044d\u0442\u043e\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u043f\u043b\u0430\u043d\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"sql\">Sort  (cost=860.61..860.61 rows=1 width=79) (actual time=0.628..0.640 rows=100 loops=1)   Sort Key: oi.id   Sort Method: quicksort  Memory: 35kB   Buffers: shared hit=417   -&gt;  Nested Loop  (cost=0.44..860.60 rows=1 width=79) (actual time=0.052..0.546 rows=100 loops=1)         Buffers: shared hit=417         -&gt;  Index Scan using idx_order_item_warehouse_id_without_nulls on order_item oi  (cost=0.14..246.83 rows=80 width=59) (actual time=0.023..0.069 rows=100 loops=1)               Index Cond: (warehouse_id = 2)               Buffers: shared hit=5         -&gt;  Index Scan using orders_pkey on orders o  (cost=0.29..7.67 rows=1 width=28) (actual time=0.003..0.003 rows=1 loops=100)               Index Cond: (id = oi.order_id)               Filter: ((status = 2) AND (created_at &gt;= (CURRENT_TIMESTAMP - '1 day'::interval)))               Buffers: shared hit=356 Planning:   Buffers: shared hit=17 Planning Time: 0.835 ms Execution Time: 0.702 ms<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0437\u043d\u0438\u0446\u0443. \u0427\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u0438 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0436\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c\u0441\u044f. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441, \u043c\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043c \u043c\u0435\u0441\u0442\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0438 \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u043c \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \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     x.indrelid::regclass::text as table_name,     x.indexrelid::regclass::text as index_name,     pg_relation_size(x.indexrelid) as index_size_bytes from pg_index x join pg_stat_all_indexes psai on x.indexrelid = psai.indexrelid where psai.schemaname = 'demo'::text;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"center\">table_name<\/p>\n<\/td>\n<td>\n<p align=\"center\">index_name<\/p>\n<\/td>\n<td>\n<p align=\"center\">index_size_bytes<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">demo.order_item<\/p>\n<\/td>\n<td>\n<p align=\"left\">demo.idx_order_item_warehouse_id<\/p>\n<\/td>\n<td>\n<p align=\"right\">1056768<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">demo.order_item<\/p>\n<\/td>\n<td>\n<p align=\"left\">demo.idx_order_item_warehouse_id_without_nulls<\/p>\n<\/td>\n<td>\n<p align=\"right\">16384<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h2>\u041f\u043b\u0430\u043d\u044b \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435<\/h2>\n<p>\u042d\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 <strong>pg-index-health<\/strong> \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c. \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/blob\/master\/README.md\" rel=\"noopener noreferrer nofollow\">README <\/a>\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 GitHub \u0438 \u043e\u043d \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0412\u043d\u0435\u0434\u0440\u0438\u0442\u044c <strong>pg-index-health<\/strong> \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Spring Boot \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0437\u0430\u0449\u0438\u0442\u0443 \u043e\u0442 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u042f \u043f\u0440\u0438\u0437\u044b\u0432\u0430\u044e \u0432\u0430\u0441 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c!<\/p>\n<p>\u0412 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u044f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432\u043e \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u0445. \u0421\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f 11-\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0438\u0437 25-\u0442\u0438. \u0422\u0430\u043a\u0436\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a: \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0442\u0438\u043a\u0435\u0442\u044b \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c 5-\u0442\u0438 \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a. \u0410 \u0435\u0449\u0451 \u0432 2025-\u043c \u0433\u043e\u0434\u0443 \u044f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 Java 17 \u0438 Spring Boot 3.<\/p>\n<h2>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043f\u043e \u0442\u0435\u043c\u0435<\/h2>\n<ul>\n<li>\n<p>\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 (<a href=\"https:\/\/habr.com\/ru\/articles\/800121\/\" rel=\"noopener noreferrer nofollow\">\u0447\u0430\u0441\u0442\u044c 1<\/a>, <a href=\"https:\/\/habr.com\/ru\/articles\/803841\/\" rel=\"noopener noreferrer nofollow\">\u0447\u0430\u0441\u0442\u044c 2<\/a>, <a href=\"https:\/\/habr.com\/ru\/articles\/821993\/\" rel=\"noopener noreferrer nofollow\">\u0447\u0430\u0441\u0442\u044c 3<\/a>)<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/companies\/tensor\/articles\/488104\/\" rel=\"noopener noreferrer nofollow\">DBA: \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/490824\/\" rel=\"noopener noreferrer nofollow\">\u0417\u0434\u043e\u0440\u043e\u0432\u044c\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0432 PostgreSQL \u0433\u043b\u0430\u0437\u0430\u043c\u0438 Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/a><\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2013 <a href=\"https:\/\/www.schemacrawler.com\/lint.html\" rel=\"noopener noreferrer nofollow\">SchemaCrawler<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/871546\/\"> https:\/\/habr.com\/ru\/articles\/871546\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>\u0421 2019 \u0433\u043e\u0434\u0430 \u044f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 open source \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\" rel=\"noopener noreferrer nofollow\">pg-index-health<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0411\u0414 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0412 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0432\u043e\u0438\u0445 <a href=\"https:\/\/habr.com\/ru\/articles\/490824\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439<\/a> \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442.<\/p>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u0433\u043e\u0434\u044b <strong>pg-index-health<\/strong> \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0438 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u043b\u0441\u044f. \u0417\u0430 2024 \u0433\u043e\u0434 \u043c\u043d\u0435 \u043f\u0440\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/graphs\/contributors?from=12%2F30%2F2023\" rel=\"noopener noreferrer nofollow\">\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u043e\u0440\u043e\u0432<\/a> \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0435\u0448\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043e\u0441\u0442\u0430\u0432\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u00ab\u0434\u0435\u0442\u0441\u043a\u0438\u0445 \u0431\u043e\u043b\u044f\u0447\u0435\u043a\u00bb \u0438 \u0434\u043e\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0433\u043e\u0442\u043e\u0432 \u043a \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u0430\u043d\u0441\u0438\u0438.<\/p>\n<h2>\u0420\u043e\u0441\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u0440\u0438\u0445\u043e\u0434\u043e\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/h2>\n<p>\u0421 PostgreSQL \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0441 2015-\u0433\u043e \u0433\u043e\u0434\u0430, \u0438 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0432 \u044f\u0440\u043e\u0441\u043b\u0430\u0432\u0441\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 <a href=\"https:\/\/habr.com\/ru\/companies\/tensor\/articles\/\" rel=\"noopener noreferrer nofollow\">\u0422\u0435\u043d\u0437\u043e\u0440<\/a>.<\/p>\n<p>2015-\u0439 \u0433\u043e\u0434 \u2014 \u044d\u0442\u043e \u0435\u0449\u0451 \u0431\u044b\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043e\u0432 \u0441 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0442\u0430\u0431\u043b\u0438\u0446. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043b\u044e\u0431\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0442\u0430\u043a\u0438\u0445 \u0411\u0414 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u0438\u043b\u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u043b\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0435\u043c \u0437\u043d\u0430\u043d\u0438\u0439. \u042d\u0442\u043e \u0437\u0430\u0449\u0438\u0449\u0430\u043b\u043e \u043e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043e\u0448\u0438\u0431\u043e\u043a, \u043d\u043e \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p>\u041f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043b\u044e\u0434\u0438 \u0441\u0442\u0430\u043b\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0440\u043e\u0441\u043b\u043e, \u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u0441\u0430\u043c\u0438\u0445 \u0431\u0430\u0437\u0430\u0445, \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0441\u043d\u0438\u0437\u0438\u043b\u043e\u0441\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u0442\u0430\u043b\u0430 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0441\u0432\u043e\u0435\u0439 \u0411\u0414. \u041f\u0440\u043e\u043f\u0430\u043b \u0435\u0434\u0438\u043d\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u0438\u0437\u044b, \u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0411\u0414 \u0441\u0442\u0430\u043b\u0438 \u043c\u043d\u043e\u0436\u0438\u0442\u044c\u0441\u044f \u0438 \u0442\u0438\u0440\u0430\u0436\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439.<\/p>\n<h2>\u041f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0435\u0451 \u0444\u043e\u0440\u043c\u044b<\/h2>\n<p>\u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u0432\u0430\u0441, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043f\u0440\u043e \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043b\u044f \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043e\u0432 \u043e\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0439 \u0432\u0438\u0434 \u0441 \u0448\u0438\u0440\u043e\u043a\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u0437 unit-\u0442\u0435\u0441\u0442\u043e\u0432. \u0417\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/martinfowler.com\/articles\/practical-test-pyramid.html\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435 \u041c\u0430\u0440\u0442\u0438\u043d\u0430 \u0424\u0430\u0443\u043b\u0435\u0440\u0430<\/a>.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u041c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u043d\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (Docker, Testcontainers). \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u0438 \u043d\u0435 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0432\u043e\u0432\u0441\u0435. \u041e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 <a href=\"https:\/\/martinfowler.com\/articles\/2021-test-shapes.html\" rel=\"noopener noreferrer nofollow\">\u0438\u043c\u0435\u0442\u044c \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u0443\u044e \u0444\u043e\u0440\u043c\u0443<\/a>. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u2014 \u044d\u0442\u043e <a href=\"https:\/\/engineering.atspotify.com\/2018\/01\/testing-of-microservices\/\" rel=\"noopener noreferrer nofollow\">Honeycomb<\/a> \u0438 Testing Trophy.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 unit-\u0442\u0435\u0441\u0442\u043e\u0432, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043d\u044b\u0445 \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0445 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u0443\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c.<\/p>\n<p>\u041c\u043e\u0439 \u043b\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0432\u043e\u0440\u0438\u0442 \u2014 \u044d\u0442\u043e <a href=\"https:\/\/kentcdodds.com\/blog\/the-testing-trophy-and-testing-classifications\" rel=\"noopener noreferrer nofollow\">Testing Trophy<\/a>. \u0412 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0430\u043a\u043e\u0439 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043b\u0435\u0436\u0438\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0437\u0432\u0430\u043d \u0437\u0430\u0449\u0438\u0449\u0430\u0442\u044c \u043e\u0442 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<h2>\u041e \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430<\/h2>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437 Java \u0438 Kotlin \u043a\u043e\u0434\u0430 \u0435\u0441\u0442\u044c \u0443\u0436\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443 \u0432\u0441\u0435\u0445. \u0412 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 \u043d\u0430 Kotlin, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/detekt\/detekt\" rel=\"noopener noreferrer nofollow\">detekt<\/a>. \u0414\u043b\u044f Java \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u0438\u0445 \u0435\u0449\u0451 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 <a href=\"https:\/\/www.sonarsource.com\/learn\/linter\/\" rel=\"noopener noreferrer nofollow\">\u043b\u0438\u043d\u0442\u0435\u0440\u0430\u043c\u0438<\/a>) \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0438\u0440\u0435. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u0442\u043e <strong>checkstyle<\/strong>, <strong>PMD<\/strong>, <strong>SpotBugs<\/strong> \u0438 <strong>Error Prone<\/strong>. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/habr.com\/ru\/articles\/680018\/\" rel=\"noopener noreferrer nofollow\">\u0432 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043d\u0430 \u0425\u0430\u0431\u0440\u0435. \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e <strong>detekt<\/strong> \u0438 <strong>checkstyle<\/strong> \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0447\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u044f\u0442 \u0437\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u0434\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <a href=\"https:\/\/github.com\/readme\/guides\/formatters-linters-compilers\" rel=\"noopener noreferrer nofollow\">formatter\u2019\u0430<\/a>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0442\u043e \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u043c\u0438\u043c\u043e \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0411\u0414.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0432 Java \u043c\u0438\u0440\u0435 \u2014 \u044d\u0442\u043e <strong>Liquibase<\/strong> \u0438 <strong>Flyway<\/strong>. \u041b\u044e\u0431\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0411\u0414 \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u0445. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430 production, \u0442\u043e \u043f\u043e\u0437\u0434\u043d\u0435\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0432\u0441\u0435\u0445 \u0441\u0442\u0435\u043d\u0434\u0430\u0445.<\/p>\n<p>\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c SQL \u2014 \u044d\u0442\u043e \u0434\u0430\u0451\u0442 \u0432\u0430\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 XML-\u0434\u0438\u0430\u043b\u0435\u043a\u0442\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 (\u0440\u0435\u0447\u044c \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u043e <strong>Liquibase<\/strong>). \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u044f \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u043e\u0431 \u044d\u0442\u043e\u043c <a href=\"https:\/\/habr.com\/ru\/articles\/501454\/\" rel=\"noopener noreferrer nofollow\">\u0432 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 SQL \u043a\u043e\u0434\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/sqlfluff.com\/\" rel=\"noopener noreferrer nofollow\">SQLFluff <\/a>(\u043f\u043e \u0441\u0443\u0442\u0438, \u044d\u0442\u043e \u0430\u043d\u0430\u043b\u043e\u0433 <strong>checkstyle<\/strong>). \u042d\u0442\u043e\u0442 \u043b\u0438\u043d\u0442\u0435\u0440 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445\/\u0434\u0438\u0430\u043b\u0435\u043a\u0442\u043e\u0432 (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 PostgreSQL) \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0432 \u0432\u0430\u0448 CI-\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d. \u041e\u043d \u0438\u043c\u0435\u0435\u0442 <a href=\"https:\/\/docs.sqlfluff.com\/en\/stable\/reference\/rules.html\" rel=\"noopener noreferrer nofollow\">\u0441\u0432\u044b\u0448\u0435 60-\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0434 \u0441\u0435\u0431\u044f. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u0430\u043c\u0438 (\u0430\u043b\u0438\u0430\u0441\u0430\u043c\u0438\/aliases) \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u043c SQL-\u043a\u043e\u043c\u0430\u043d\u0434, \u043e\u0442\u0441\u0442\u0443\u043f\u0430\u043c\u0438, \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0438 \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0432\u0435\u0449\u0430\u043c\u0438. \u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e:<\/p>\n<pre><code class=\"sql\">-- \u0441\u043e \u0441\u0442\u0440\u043e\u0433\u0438\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c select     pc.oid::regclass::text as table_name,     pg_table_size(pc.oid) as table_size from     pg_catalog.pg_class pc     inner join pg_catalog.pg_namespace nsp on nsp.oid = pc.relnamespace where     pc.relkind = 'r' and     pc.oid not in (         select c.conrelid as table_oid         from pg_catalog.pg_constraint c         where c.contype = 'p'     ) and     nsp.nspname = :schema_name_param::text order by table_name;<\/code><\/pre>\n<pre><code class=\"sql\">-- \u0431\u0435\u0437 \u0441\u0442\u0440\u043e\u0433\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f SELECT pc.oid::regclass::text AS table_name, pg_table_size(pc.oid) AS table_size FROM pg_catalog.pg_class  pc JOIN pg_catalog.pg_namespace AS nsp ON nsp.oid =  pc.relnamespace WHERE pc.relkind = 'r\u2019  and pc.oid NOT in (   select c.conrelid as table_oid   from pg_catalog.pg_constraint   c   where    c.contype = 'p\u2019 ) and nsp.nspname  = :schema_name_param::text ORDER BY  table_name;<\/code><\/pre>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 SQL \u043a\u043e\u0434 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0435\u0433\u0447\u0435 \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c. \u0418 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u043d\u0430 code review \u0432\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u0442\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0432\u043a\u0443\u0441\u043e\u0432\u0449\u0438\u043d\u044b. <strong>SQLFluff<\/strong> \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 SQL \u043a\u043e\u0434 \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0443. \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c pull request\u2019\u0435:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>SQLFluff<\/strong><\/figcaption><\/div>\n<\/figure>\n<p>\u0417\u0434\u0435\u0441\u044c <strong>SQLFluff<\/strong> \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <strong>select<\/strong>: \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u0442\u043e \u043d\u0435 \u0432\u044b\u043d\u043e\u0441\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \u0412\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u2013 \u044d\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u0432\u044b\u0431\u043e\u0440\u043a\u0438: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u0418 \u0442\u0440\u0435\u0442\u044c\u0435 \u2014 \u044d\u0442\u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0434\u043b\u044f <strong>and<\/strong> \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 <strong>join<\/strong>\u2019\u0430: \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043d\u0438\u0436\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435.<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>SQLFluff<\/strong> \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0443 \u043c\u0435\u043d\u044f \u0432 open source \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445: <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health-sql\/blob\/master\/.github\/linters\/.sqlfluff\" rel=\"noopener noreferrer nofollow\">\u043e\u0434\u0438\u043d<\/a>, <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health-demo\/blob\/master\/.github\/linters\/.sqlfluff\" rel=\"noopener noreferrer nofollow\">\u0434\u0432\u0430<\/a>.<\/p>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0411\u0414<\/h2>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u0430\u043c\u043e\u0439 \u0411\u0414 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e: \u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e; \u043d\u043e\u0432\u0430\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0438 \u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435. \u041d\u0430\u0441, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0411\u0414, \u0447\u0435\u043c \u0435\u0451 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>UPM \u043e\u0442 Meta<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/engineering.fb.com\/2022\/11\/30\/data-infrastructure\/static-analysis-sql-queries\/\" rel=\"noopener noreferrer nofollow\">\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c UPM<\/a>\u00a0\u043e\u0442 Meta\/Facebook \u0443\u043c\u0435\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e SQL \u043a\u043e\u0434, \u043d\u043e \u043d\u0435\u044f\u0441\u043d\u043e, \u043c\u043e\u0436\u0435\u0442 \u043b\u0438 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<\/div>\n<\/details>\n<p>PostgreSQL (\u043a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0411\u0414) \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 \u0438 \u0441\u0432\u044f\u0437\u044f\u0445 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u043d\u0430\u0440\u0443\u0436\u0443 \u0432 \u0432\u0438\u0434\u0435 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Information_schema\" rel=\"noopener noreferrer nofollow\">information_schema<\/a>. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a <strong>information_schema<\/strong> \u0434\u043b\u044f \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0439, \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438\u043b\u0438 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a (\u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0435\u0442 <a href=\"https:\/\/github.com\/schemacrawler\/SchemaCrawler\/tree\/v16.24.3\/schemacrawler-postgresql\/src\/main\/resources\/postgresql.information_schema\" rel=\"noopener noreferrer nofollow\">SchemaCrawler<\/a>).<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 PostgreSQL, \u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e <strong>information_schema<\/strong> \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 (\u0441\u0445\u0435\u043c\u0430 <a href=\"https:\/\/www.postgresql.org\/docs\/current\/catalogs.html\" rel=\"noopener noreferrer nofollow\">pg_catalog<\/a>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u044e\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445: \u043a\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0438 \u0442.\u0434. \u0417\u0430 \u0441\u0431\u043e\u0440 \u044d\u0442\u0438\u0445 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 (<a href=\"https:\/\/www.postgresql.org\/docs\/current\/monitoring-stats.html\" rel=\"noopener noreferrer nofollow\">The Cumulative Statistics System<\/a>). \u041e\u0431\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u0438\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health-sql\/blob\/master\/sql\/unused_indexes.sql\" rel=\"noopener noreferrer nofollow\">\u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f<\/a>, \u0438\u043b\u0438 <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health-sql\/blob\/master\/sql\/tables_with_missing_indexes.sql\" rel=\"noopener noreferrer nofollow\">\u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0433\u0434\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442<\/a>.<\/p>\n<p>\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 <a href=\"https:\/\/www.postgresql.org\/docs\/17\/monitoring-stats.html#MONITORING-STATS-FUNCTIONS\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e<\/a>. \u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0431\u0440\u043e\u0441\u0430 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u0412\u0430\u0436\u043d\u043e \u044d\u0442\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 \u0438\u043b\u0438 \u043d\u0435\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0440\u0430\u0437 \u0432 \u043c\u0435\u0441\u044f\u0446\/\u043a\u0432\u0430\u0440\u0442\u0430\u043b\/\u043f\u043e\u043b\u0443\u0433\u043e\u0434\u0438\u0435, \u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0437\u0430 \u043f\u0435\u0440\u0438\u043e\u0434 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0411\u0414, \u0442\u043e \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0438 \u043d\u0435 \u0440\u0435\u043f\u043b\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430.<\/p>\n<h2>pg-index-health \u0438 \u0435\u0433\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430<\/h2>\n<p>\u0418\u0434\u0435\u044f \u0441 \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0411\u0414 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u044b, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432\u044b\u0448\u0435, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043c\u043d\u043e\u0439 \u0432 \u0432\u0438\u0434\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\" rel=\"noopener noreferrer nofollow\">pg-index-health<\/a>.<\/p>\n<p>\u041c\u043e\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u0431\u043e\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0432 \u0432\u0438\u0434\u0435 sql-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0445 <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health-sql\" rel=\"noopener noreferrer nofollow\">\u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a> (\u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044d\u0442\u043e 25 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a). \u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u044b \u043e\u0442 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b \u043d\u0430 Java \u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043c\u0435\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/blob\/f6a4fb0740a14e6c156531fa22a03dad5a84a12b\/pg-index-health-jdbc-connection\/src\/main\/java\/io\/github\/mfvanek\/pg\/connection\/HighAvailabilityPgConnection.java#L22\" rel=\"noopener noreferrer nofollow\">HighAvailabilityPgConnection<\/a> \u043d\u0430\u0434 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043a \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0445\u043e\u0441\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f sql-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>Spring Boot starter \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0432 unit\/\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043d\u044b\u0435\/\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0435 sql-\u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0412\u0438\u0434\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a<\/h2>\n<p>\u0412\u0441\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (\u043e\u043d\u0438 \u0436\u0435 <a href=\"https:\/\/github.com\/mfvanek\/pg-index-health\/blob\/f6a4fb0740a14e6c156531fa22a03dad5a84a12b\/pg-index-health-core\/src\/main\/java\/io\/github\/mfvanek\/pg\/core\/checks\/common\/Diagnostic.java#L25\" rel=\"noopener noreferrer nofollow\">\u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438<\/a>) \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0435 \u0433\u0440\u0443\u043f\u043f\u044b:<\/p>\n<ul>\n<li>\n<p>runtime \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (\u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438);<\/p>\n<\/li>\n<li>\n<p>\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (\u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438).<\/p>\n<\/li>\n<\/ul>\n<p><strong>Runtime \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438<\/strong> \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u043c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 production. \u042d\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0438 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044e\u0442 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0441\u043e \u0432\u0441\u0435\u0445 \u0445\u043e\u0441\u0442\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0411\u0414 \u0438\u0437 3-\u0445 \u0445\u043e\u0441\u0442\u043e\u0432: primary, secondary \u0438 async replica. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u044b \u0441 \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u0442\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u0435\u0439 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0442\u044f\u0436\u0451\u043b\u044b\u0435 \u0447\u0438\u0442\u0430\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0435 \u0434\u043b\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u041d\u0430 primary \u0445\u043e\u0441\u0442\u0435 \u0442\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 latency \u0434\u0440\u0443\u0433\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041a\u043b\u0430\u0441\u0442\u0435\u0440 \u0411\u0414 PostgreSQL<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0440\u0430\u043d\u0435\u0435, \u0432 PostgreSQL \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0438 \u043d\u0435 \u0440\u0435\u043f\u043b\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0443 \u0432\u0430\u0441 \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u0447\u0442\u043e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0438 \u043d\u0443\u0436\u043d\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,<\/p>\n<\/div>\n<\/div>\n<\/div>\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-444135","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444135","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=444135"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444135\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=444135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=444135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=444135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}