- Learning Tableau 2020
- Joshua N. Milligan
- 500字
- 2021-06-11 18:31:01
Performance considerations
When working with a small dataset and an efficient database, you often won't notice inefficient calculations. With larger datasets, the efficiency of your calculations can start to make a difference to the speed at which a view is rendered.
Here are some tips for making your calculations as efficient as possible:
- Boolean and numeric calculations are much faster than string calculations. If possible, avoid string manipulation and use aliasing or formatting to provide user-friendly labels. For example, don't write the following code: IF [value] == 1 THEN "Yes" ELSE "No" END. Instead, simply write [value] == 1, and then edit the aliases of the field and set True to Yes and False to No.
- Look for ways to increase the efficiency of a calculation. If you find yourself writing a long IF ELSEIF statement with lots of conditions, see whether there are one or two conditions that you can check first to eliminate the checks of all the other conditions. For example, let's consider simplifying the following code:
//This is potentially less efficient... IF [Type] = "Dog" AND [Age] < 1 THEN "Puppy" ELSEIF [Type] = "Cat" AND [Age] < 1 THEN "Kitten" END //...than this code: IF [Age] < 1 THEN IF [Type] = "Dog" THEN "Puppy" ELSEIF [Type] = "Cat" THEN "Kitten" END END
Notice how the check of type doesn't have to be done for any records where the age was less than 1. That could be a very high percentage of records in the dataset.
- Row-level calculations have to be performed for every row of data. Try to minimize the complexity of row-level calculations. However, if that is not possible or doesn't solve a performance issue, consider the final option.
- When you create a data extract, certain row-level calculations are materialized. This means that the calculation is performed once when the extract is created, and the results are then stored in the extract. This means that the data engine does not have to execute the calculation over and over. Instead, the value is simply read from the extract. Calculations that use any user functions, parameters, or TODAY() or NOW(), will not be materialized in an extract as the value necessarily changes according to the current user, parameter selection, and system time. Tableau's optimizer may also determine whether to materialize certain calculations that are more efficiently performed in memory rather than having to read the stored value.
When you use an extract to materialize row-level calculations, only the calculations that were created at the time of the extract are materialized. If you edit calculated fields or create new ones after creating the extract, you will need to optimize the extract (use the drop-down menu on the data source or select it from the Data menu and then select Extract | Optimize or Extract | Compute Calculations Now).
As you continue to work with calculations, pay special attention to situations where you notice performance issues, and consider whether you can optimize your calculations for better results.
- Microsoft Dynamics GP 2016 Cookbook
- 中國新股民必讀手冊(2015年最新版)
- 金融科技(FinTech)發展的國際經驗和中國政策取向(中國金融四十人論壇書系)
- Microsoft Dynamics NAV Financial Management
- Citrix? XenMobile? Mobile Device Management
- Metabase Up and Running
- Big Data Visualization
- EViews10.0的應用與計量分析
- Salesforce Essentials for Administrators
- 《企業內部控制基本規范》合規實務指南
- 從零開始學房地產會計
- Stata統計分析與行業應用案例詳解(第2版)
- Oracle Primavera Contract Management,Business Intelligence Publisher Edition v14
- 內審人員進階之道:內部審計操作實務與案例解析
- 統計學理論前沿(谷臻小簡·AI導讀版)