是否可以在sql中用HS join替换NL join

时间:2013-01-03 09:53:59

标签: sql db2 query-optimization

你有一个非常大的查询包括两个主表和15个子表。

ie, Main table say table_a join with some other 10 tables.
and another main table sat table_b join with some other 5 tables.

Table_a contains - 314988 rows and 
Table_b contains - 710989 rows.

当我们加入时,我可以找到很多NL连接和HS连接。

有趣的是,所有HSjoin cost very less and NL join cost非常高。

因此可以将连接从NL转换为HS Join。

注意:它全部已编入索引..没有TBSCAN,一切都是IXSCAN。

1 个答案:

答案 0 :(得分:1)

您可以创建优化配置文件,在优化配置文件中,您将向优化程序指示应使用哪些方法来访问给定查询的数据。

从DeveloperWorks看一下这个教程:http://www.ibm.com/developerworks/data/library/techarticle/dm-1202storedprocedure/index.html