{"id":10342,"date":"2020-03-17T00:00:00","date_gmt":"2020-03-17T05:00:00","guid":{"rendered":"https:\/\/threecloud.wpengine.com\/post\/import-vs-directquery-storage-mode-2\/"},"modified":"2022-11-30T09:25:09","modified_gmt":"2022-11-30T15:25:09","slug":"import-vs-directquery-storage-mode","status":"publish","type":"post","link":"https:\/\/3cloudsolutions.com\/resources\/import-vs-directquery-storage-mode\/","title":{"rendered":"Import vs DirectQuery Storage Mode?"},"content":{"rendered":"<p><strong>When designing a Power BI, SQL Server Analysis Service Tabular or Azure Analysis Services data model, what are the pros and cons for using Import vs DirectQuery storage mode?<\/strong><\/p>\n<p>At a recent SQL Saturday, someone said they were using DirectQuery mode and some DAX functions were not working very well, how do we resolve this?<\/p>\n<p><strong>With a lot of data and millions of rows, DirectQuery may seem the right thing to do; but my advice is to start with import mode in most, if not all, cases.<\/strong> Some may argue that if they have a fact table with millions of rows and many columns that it\u2019s going to take up a lot of space.<\/p>\n<div class=\"hs-responsive-embed-wrapper hs-responsive-embed\" style=\"width: 100%; height: auto; position: relative; overflow: hidden; padding: 0; max-width: 560px; max-height: 315px; min-width: 256px; margin: 0px auto; display: block;\">\n<div class=\"hs-responsive-embed-inner-wrapper\" style=\"position: relative; overflow: hidden; max-width: 100%; padding-bottom: 56.25%; margin: 0;\"><iframe loading=\"lazy\" class=\"hs-responsive-embed-iframe\" style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;\" src=\"\/\/www.youtube.com\/embed\/SX7LziOuc0o\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\" data-service=\"youtube\"><\/iframe><\/div>\n<\/div>\n<p>Here\u2019s my advice. First,<strong> figure out how much memory it will take and be very conservative about the columns that you import into your model.<\/strong> Make it a point to only use the columns that you <strong>actually<\/strong> need based on your current requirements. Keep it small; you can always add additional columns later and expand the scope of your model.<\/p>\n<p>Secondly, you want to <strong>avoid unique columns like distinct values that don\u2019t compress well, such as a fact table with a sales key or an order ID.<\/strong> Import mode compresses each individual column which is efficient and can significantly reduce the memory footprint.<\/p>\n<p>If you can keep the total file size under 1GB, then import mode is the way to go. <strong>In a case where you may need to drill down from a summary table into a transaction detail table and require up to the minute data updates, you can then use mixed mode or DirectQuery.<\/strong> Although this should be the exception, not the rule.<\/p>\n<p>There\u2019s an advanced level design known as composite model where some tables are import mode and some are DirectQuery. I highly suggest graduating to this model rather than starting with it \u2013 you may find it\u2019s not even necessary.<\/p>\n<p>Another tip is we can use partitioning with the <strong>incremental refresh<\/strong> feature to keep data up to date. This is now available with a Pro, as well as Premium, license. <strong>With incremental refresh you can keep your data up to date within the hour, or even less;<\/strong> no reason to have data that\u2019s days old because you\u2019re using import mode.<\/p>\n<p><strong>Need further help? Our expert team and solution offerings can help your business with any Azure product or service, including Managed Services offerings. Contact us at 888-8AZURE or\u00a0 <a href=\"mailto:sales@3cloudsolutions.com\">sales@3cloudsolutions.com<\/a>.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When designing a Power BI, SQL Server Analysis Service Tabular or Azure Analysis Services data&mldr;<\/p>\n","protected":false},"author":110,"featured_media":10721,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[260],"tags":[],"class_list":["post-10342","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-ai","topics-blog"],"acf":[],"_links":{"self":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts\/10342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/comments?post=10342"}],"version-history":[{"count":0,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts\/10342\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/media\/10721"}],"wp:attachment":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/media?parent=10342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/categories?post=10342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/tags?post=10342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}