power bi_如何将Power BI模型的尺寸减少90%!

本文翻译自《如何将Power BI模型的尺寸减少90%》一文,分享了如何有效降低Power BI数据模型的大小,以提高性能和效率。

power bi

Have you ever wondered what makes Power BI so fast and powerful when it comes to performance? So powerful, that it performs complex calculations over millions of rows in a blink of an eye.

您是否想过什么使Power BI在性能方面如此之快和强大? 如此强大,它可以在一瞬间对数百万行执行复杂的计算。

In this series of articles, we will dig deep to discover what is “under the hood” of Power BI, how your data is being stored, compressed, queried, and finally, brought back to your report. Once you finish reading, I hope that you will get a better understanding of the hard work happening in the background and appreciate the importance of creating an optimal data model in order to get maximum performance from the Power BI engine.

在本系列文章中,我们将深入研究以发现Power BI的“内幕”,以及如何存储,压缩,查询您的数据,最后将它们带回到您的报告中。 阅读完本书后,我希望您能更好地了解在后台进行的艰苦工作,并希望了解创建最佳数据模型以从Power BI引擎获得最佳性能的重要性。

After we laid the theoretical ground for understanding architecture behind VertiPaq storage engine, and which types of compression it uses to optimize your Power BI data model, it’s the right moment to make our hands dirty and apply our knowledge in real-life case!

在为理解VertiPaq存储引擎背后的体系结构以及用于优化Power BI数据模型的压缩类型奠定了理论基础之后 ,是时候动手动手,并在实际案例中运用我们的知识了!

起点= 777 MB (Starting point = 777 MB)

Our data model is quite simple, yet memory exhaustive. We have a fact table (factChat) which contains data about live support chats and one dimension table (dimProduct), that relates to a fact table. Our fact table has around 9 million rows, which should not be a big deal for Power BI, but the table was imported as it is, without any additional optimization or transformation.

我们的数据模型非常简单,但内存却无穷。 我们有一个事实表(factChat),其中包含有关实时支持聊天的数据,以及一个与事实表相关的一维表(dimProduct)。 我们的事实表大约有900万行,这对于Power BI来说应该不是什么大问题,但是该表是按原样导入的,没有进行任何其他优化或转换。

Image for post

Now, this pbix file consumes whopping 777 MB!!! You can’t believe it? Just take a look:

现在,这个pbix文件消耗了777 MB! 你不敢相信吗? 看看吧:

Image for post

Just remember this picture! Of course, I don’t need to tell you how much time this report needs to load or refresh, and how our calculations are slow because of the file size.

只要记住这张照片! 当然,我不需要告诉您此报告需要加载或刷新多少时间,并且由于文件大小而导致我们的计算速度变慢。

……甚至更糟! (…and it’s even worse!)

Additionally, it’s not just 777 MBs that takes our memory, since memory consumption is being calculated taking into account the following factors:

此外,占用内存的不仅仅是777 MB,因为要考虑以下因素来计算内存消耗:

  • PBIX file

    PBIX文件
  • Dictionary (you’ve learned about the dictionary in this article)

    字典(您已经在本文中了解了字典)

  • Column hierarchies

    列层次结构
  • User-defined hierarchies

    用户定义的层次结构
  • Relationships

    人际关系

Now, if I open Task Manager, go to the Details tab and find the msmdsrv.exe process, I will see that it burns more than 1 GB of the memory!

现在,如果我打开任务管理器,请转到“详细信息”选项卡并找到msmdsrv.exe进程,我将看到它消耗了超过1 GB的内存!

Image for post

Oh, man, that really hurts! And we haven’t even interacted with the report! So, let’s see what we can do to optimize our model…

哦,老兄,真痛! 而且我们甚至都没有与报告互动! 因此,让我们

Power BI 连接 MySQL 的上下文中,`powerbi_client_ip` 并不是一个标准的配置参数或环境变量,而是用于描述 **Power BI 客户端连接 MySQL 服务器时所使用的源 IP 地址**。这一“参数”通常出现在数据库权限管理中,用以指定哪些客户端 IP 地址被允许访问特定的数据库资源。 例如,在 MySQL 中设置用户权限时,可以限制某个用户只能从特定的 IP 地址进行连接: ```sql GRANT ALL PRIVILEGES ON *.* TO 'username'@'powerbi_client_ip' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; ``` 上述语句中的 `'username'@'powerbi_client_ip'` 表示用户名为 `username` 的用户只能从 IP 为 `powerbi_client_ip` 的主机上发起连接请求。这是数据库安全策略的一部分,有助于防止未经授权的远程访问[^1]。 若 Power BI 客户端所在的机器 IP 地址未被正确添加到 MySQL 的访问控制列表中,则会出现连接失败的问题。因此,确保 MySQL 用户权限配置中包含 Power BI 客户端的实际 IP 地址是解决此类问题的关键步骤之一。 ### 相关配置与环境变量 除了 `powerbi_client_ip` 所代表的 IP 权限控制外,Power BI 连接 MySQL 时还可能涉及以下配置参数和环境变量: - **Server / Hostname**:MySQL 数据库服务器的地址,可附加端口号(如 `192.168.1.100:13306`)。 - **Port**:MySQL 服务监听的端口,默认为 `3306`,但在某些部署环境中可能更改。 - **Database Name**:要连接的具体数据库名称。 - **User ID / Password**:用于认证的数据库用户名和密码。 - **SSL Mode**:是否启用 SSL 加密连接,选项包括 `None`, `Required`, `VerifyCA`, `VerifyFull` 等。 - **Connection Timeout**:连接超时时间设定,影响 Power BI 尝试连接的最等待时间。 - **CharacterSet**:指定连接使用的字符集,如 `utf8mb4`。 - **Pooling**:是否启用连接池,提高连接效率。 此外,Power BI 使用的 MySQL 数据网关依赖于底层的 .NET 或 ODBC 驱动程序,这些驱动程序也可能支持通过环境变量或配置文件设置默认行为,例如: - `MYSQL_HOME`:定义 MySQL 客户端工具和库的安装路径。 - `ODBCINI`:指定 ODBC 配置文件的位置。 - `LD_LIBRARY_PATH`(Linux)或 `PATH`(Windows):用于查找 MySQL 动态链接库或驱动程序。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值