简体   繁体   English

SAP HANA计算视图中JOINS的性能

[英]Performance of JOINS in SAP HANA Calculation View

For Example: I have 4 columns (A,B,C,D). 例如:我有4列(A,B,C,D)。

I thought that instead of connecting each and every column in join I should make a concatenated column in both projection(CA_CONCAT-> A+B+C+D) and make a join on this, Just to check on which method performance is better. 我认为与其连接每个列,不如在两个投影中都创建一个串联的列(CA_CONCAT-> A + B + C + D)并对此进行连接,只是为了检查哪种方法性能更好。

It was working faster earlier but in few CV's this method is slower sometimes, especially at time of filtering! 它的工作速度较早,但在少数CV中这种方法有时会较慢,尤其是在过滤时!

Can any one suggest which is an efficient method? 谁能建议这是一种有效的方法?

I don't think the JOIN conditions with concatenated fields will work better in performance. 我不认为带有连接字段的JOIN条件在性能上会更好。

Although we say in general there is not a need for index on column tables on HANA database, the column tables have a structure that works with an index on every column. 尽管我们通常说不需要在HANA数据库上的列表上建立索引,但是列表具有可与每个列上的索引一起使用的结构。 So if you concatenate 4 columns and produce a new calculated field, first you loose the option to use these index on 4 columns and the corresponding joining columns 因此,如果连接4列并生成一个新的计算字段,则首先要松开使用这些索引在4列和相应连接列上的选项

I did not check the execution plan, but it will probably make a full scan on these columns 我没有检查执行计划,但可能会对这些列进行全面扫描

In fact I'm surprised you have mentioned that it worked faster, and experienced problems only on a few 实际上,我很惊讶您提到它运行速度更快,并且仅在少数情况下遇到问题

Because concatenation or applying a function on a database column is even only by itself a workload over the SELECT process. 因为在数据库列上进行串联或应用功能本身仅是SELECT进程的工作量。 It might include implicit type cast operation, which might bring additional workload more than expected 它可能包括隐式类型转换操作,这可能会带来超出预期的更多工作量

First I would suggest considering setting your table to column store and check the new performance. 首先,我建议考虑将表设置为列存储并检查新性能。

After that I would suggest to separate the JOIN to multiple JOINs if you are using OR condition in your join. 之后,如果您在联接中使用OR条件,我建议将JOIN分离为多个JOIN。

Third, INNER JOIN will give you better performance compare to LEFT JOIN or LEFT OUTER JOIN. 第三,与LEFT JOIN或LEFT OUTER JOIN相比,INNER JOIN将为您提供更好的性能。

Another thing about JOINs and performance, you better use them on PRIMARY KEYS and not on each column. 关于JOIN和性能的另一件事,您最好在PRIMARY KEYS而不是每个列上使用它们。

For me, both the time join with multiple fields is performing faster than join with concatenated fields. 对我来说,与多个字段进行连接的时间比与串联字段进行连接的时间要快。 For filtering scenario, planviz shows when I join with multiple fields, filter gets pushed down to both the tables. 对于过滤方案,planviz显示了当我加入多个字段时,过滤器被下推到两个表。 On the other hand, when I join with concatenated field only one table gets filtered. 另一方面,当我使用串联字段联接时,只有一个表被过滤。

However, if you put filter on both the fields (like PRODUCT from Tab1 and MATERIAL from Tab2), then you can push the filter down to both the tables. 但是,如果在两个字段上都放置了过滤器(如Tab1中的PRODUCT和Tab2中的MATERIAL),则可以将过滤器向下推到两个表中。

Like: 喜欢:

Select * from CalculationView where PRODUCT = 'A' and MATERIAL = 'A' 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM