{"id":555,"date":"2013-10-11T10:00:25","date_gmt":"2013-10-11T17:00:25","guid":{"rendered":"http:\/\/www.sqldbpros.com\/?p=555"},"modified":"2014-03-03T13:40:55","modified_gmt":"2014-03-03T20:40:55","slug":"add-page-compression-to-every-table-in-your-sql-database-the-winston-wolf-way","status":"publish","type":"post","link":"http:\/\/sqldbpros.com\/wordpress\/2013\/10\/add-page-compression-to-every-table-in-your-sql-database-the-winston-wolf-way\/","title":{"rendered":"Add Page Compression To Every Table In Your SQL Database The Winston Wolf Way"},"content":{"rendered":"<p>So you need to add page level compression to every table in your SQL Server database? I'm not going to judge you. I'm not going to tell you it's a good idea or a bad idea. I needed to do it in my DEV environment and maybe you need to do it in your production SQL Server environment. I can help you. Listen. I'm not particularly proud of this script. It's not complex or difficult. It didn't take hours of finally honed SQL-smithing to make it work. It just solved a problem. Many people consider me the Winston Wolf of the SQL world. Well, actually I'm the only one who considers myself the Winston Wolf of the SQL world but whatever.<\/p>\n<p>Who is Winston Wolf you ask? Pulp Fiction my friend.<\/p>\n<blockquote><p>The Wolf: You're... Jimmie, right? This is your house?<br \/>\nJimmie: Sure is.<br \/>\nThe Wolf: I'm Winston Wolfe. I solve problems.<br \/>\nJimmie: Good, we got one.<br \/>\nThe Wolf: So I heard. May I come in?<br \/>\nJimmie: Uh, yeah, please do.<\/p><\/blockquote>\n<figure id=\"attachment_556\" aria-describedby=\"caption-attachment-556\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.sqldbpros.com\/wordpress\/wp-content\/uploads\/2013\/10\/page-compression.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-556\" alt=\"Page compression? Not a problem. Get me some coffee...\" src=\"http:\/\/www.sqldbpros.com\/wordpress\/wp-content\/uploads\/2013\/10\/page-compression.jpg\" width=\"500\" height=\"221\" srcset=\"http:\/\/sqldbpros.com\/wordpress\/wp-content\/uploads\/2013\/10\/page-compression.jpg 500w, http:\/\/sqldbpros.com\/wordpress\/wp-content\/uploads\/2013\/10\/page-compression-300x132.jpg 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-556\" class=\"wp-caption-text\">Page compression? Not a problem. Get me some more coffee...<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>So, just run the little diddy below and it will produce a script that will add page compression to each table. Boom. You're golden.<\/p>\n<p>&nbsp;<\/p>\n<pre>\r\nSELECT\r\n    'ALTER TABLE [' + table_schema + '].[' + table_name\r\n    + '] REBUILD WITH (DATA_COMPRESSION = PAGE);'\r\nFROM\r\n    INFORMATION_SCHEMA.tables\r\nWHERE\r\n    INFORMATION_SCHEMA.TABLES.TABLE_TYPE = 'BASE TABLE'\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>So you need to add page level compression to every table in your SQL Server database? I'm not going to judge you. I'm not going to tell you it's a good idea or a bad idea. I needed to do it in my DEV environment and maybe you need to do it in your production [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43,8,3,122,57],"tags":[98,116],"class_list":["post-555","post","type-post","status-publish","format-standard","hentry","category-microsoft-sql-server","category-performance-tuning","category-scripts","category-ssdt-sql-server-data-tools","category-t-sql","tag-compression","tag-pulp-fiction"],"_links":{"self":[{"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/posts\/555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/comments?post=555"}],"version-history":[{"count":1,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/posts\/555\/revisions"}],"predecessor-version":[{"id":557,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/posts\/555\/revisions\/557"}],"wp:attachment":[{"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/media?parent=555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/categories?post=555"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/sqldbpros.com\/wordpress\/wp-json\/wp\/v2\/tags?post=555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}