{"id":8693,"date":"2020-09-22T17:29:16","date_gmt":"2020-09-22T09:29:16","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=8693"},"modified":"2020-09-22T17:29:16","modified_gmt":"2020-09-22T09:29:16","slug":"vacuumdb","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/vacuumdb","title":{"rendered":"vacuumdb\u547d\u4ee4 – \u6e05\u7406\u5e76\u4f18\u5316PostgreSQL\u6570\u636e\u5e93"},"content":{"rendered":"\n
vacuumdb\u547d\u4ee4\u7684\u4f5c\u7528\u662f\u53ef\u4ee5\u6e05\u7406\u5e76\u4f18\u5316\u4e00\u4e2aPostgreSQL\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n
vacuumdb\u547d\u4ee4\u4e5f\u5c06\u4ea7\u751f\u7531PostgreSQL\u67e5\u8be2\u4f18\u5316\u5668\u6240\u4f7f\u7528\u7684\u5185\u90e8\u7edf\u8ba1\u4fe1\u606f\u3002<\/p>\n\n\n\n
vacuumdb\u547d\u4ee4\u662fSQL\u547d\u4ee4VACUUM\u7684\u4e00\u4e2a\u5305\u88c5\u5668\u3002\u5728\u901a\u8fc7\u8fd9\u4e2a\u5de5\u5177\u548c\u5176\u4ed6\u65b9\u6cd5\u8bbf\u95ee\u670d\u52a1\u5668\u6765\u6e05\u7406\u548c\u5206\u6790\u6570\u636e\u5e93\u4e4b\u95f4\u6ca1\u6709\u5b9e\u8d28\u6027\u7684\u533a\u522b\u3002\u867d\u7136\u5728\u65b0\u7248\u672c\u7684PostgreSQL\u4e2d\u6709\u81ea\u52a8\u7684vacuum\uff0c\u4f46\u662f\u5982\u679c\u662f\u5927\u6279\u91cf\u7684\u6570\u636eIO\u53ef\u80fd\u4f1a\u5bfc\u81f4\u81ea\u52a8\u6267\u884c\u5f88\u6162\uff0c\u9700\u8981\u914d\u5408\u624b\u52a8\u6267\u884c\u4ee5\u53ca\u81ea\u5df1\u7684\u811a\u672c\u6765\u6e05\u7406\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong><\/strong>vacuumdb [\u53c2\u6570] [\u6570\u636e\u5e93\u540d]<\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n \u6e05\u7406\u6240\u6709\u7684\u6570\u636e\u5e93\uff1a<\/p>\n\n\n\n \u4e3a\u4f18\u5316\u5668\u6e05\u7406\u548c\u5206\u6790\u4e00\u4e2a\u540d\u4e3abigdb\u7684\u6570\u636e\u5e93\uff1a<\/p>\n\n\n\n \u6e05\u7406\u6570\u636e\u5e93linuxcool\u4e2d\u7684table1\u8868\uff1a<\/p>\n\n\n\n vacuumdb\u547d\u4ee4\u7684\u4f5c\u7528\u662f\u53ef\u4ee5\u6e05\u7406\u5e76\u4f18\u5316\u4e00\u4e2aPostgreSQL\u6570\u636e\u5e93\u3002 vacuumdb\u547d\u4ee4\u4e5f\u5c06\u4ea7\u751f\u7531Po […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8693"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=8693"}],"version-history":[{"count":2,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8693\/revisions"}],"predecessor-version":[{"id":8710,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8693\/revisions\/8710"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=8693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=8693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=8693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}-a<\/td> \u6e05\u7406\u6240\u6709\u7684\u6570\u636e\u5e93<\/td><\/tr> -d<\u6570\u636e\u5e93\u540d\u79f0><\/td> \u6e05\u7406\u6307\u5b9a\u7684\u6570\u636e\u5e93<\/td><\/tr> -e<\/td> \u663e\u793a\u53d1\u9001\u5230\u670d\u52a1\u7aef\u7684\u547d\u4ee4<\/td><\/tr> -f<\/td> \u5b8c\u5168\u6e05\u7406<\/td><\/tr> -F<\/td> \u51bb\u7ed3\u8bb0\u5f55\u7684\u4e8b\u52a1\u4fe1\u606f<\/td><\/tr> -q<\/td> \u4e0d\u5199\u4efb\u4f55\u4fe1\u606f<\/td><\/tr> -t<\u8868\u540d><\/td> \u53ea\u6e05\u7406\u6307\u5b9a\u7684\u8868<\/td><\/tr> -U<\u7528\u6237\u540d><\/td> \u6307\u5b9a\u8fde\u63a5\u7684\u7528\u6237\u540d<\/td><\/tr> -w<\/td> \u6c38\u8fdc\u4e0d\u63d0\u793a\u8f93\u5165\u53e3\u4ee4<\/td><\/tr> -W<\/td> \u5f3a\u5236\u63d0\u793a\u8f93\u5165\u53e3\u4ee4<\/td><\/tr> -h<\u4e3b\u673a\u540d><\/td> \u6570\u636e\u5e93\u670d\u52a1\u5668\u6240\u5728\u4e3b\u673a\u7684\u4e3b\u673a\u540d\u6216\u5957\u63a5\u5b57\u76ee\u5f55<\/td><\/tr> -p<\u7aef\u53e3\u53f7><\/td> \u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u53f7<\/td><\/tr> -z<\/td> \u66f4\u65b0\u4f18\u5316\u5668\u4fe1\u606f<\/td><\/tr> -v<\/td> \u8f93\u51fa\u5927\u91cf\u7684\u4fe1\u606f<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n [root@linuxcool ~]# su - postgres\n$\u00a0vacuumdb -a<\/pre>\n\n\n\n
[root@linuxcool ~]# su - postgres\n$\u00a0vacuumdb -z bigdb<\/pre>\n\n\n\n
[root@linuxcool ~]# su - postgres\n$\u00a0vacuumdb -d linuxcool -t 'table1'<\/pre>\n","protected":false},"excerpt":{"rendered":"