将内部联接转换为存储过程及其性能影响

时间:2016-11-18 15:38:22

标签: database stored-procedures db2

select pa.PRODUCT_ID,a.IDENTIFIER,av.DATA, avd.value from PRODUCTATTRIBUTE pa
inner join ATTR a  on a.ATTR_ID = pa.ATTR_ID
inner join ATTRVAL av  on av.ATTRVAL_ID = pa.ATTRVAL_ID
inner join ATTRVALDESC avd   on avd.ATTRVAL_ID = av.ATTRVAL_ID
inner join PRODUCT p on p.PRODUCT_ID= pa.CATENTRY_ID and p.PRODUCTTYPE_ID = 'Product'  and p.DELETED = 0
where a.IDENTIFIER = 'Ordered' and avd.VALUE = '$input' and avd.LANGUAGE_ID=-11

> **Table              - Columns**
> 
> PRODUCTATTRIBUTE   - PRODUCT_ID, ATTR_ID and ATTRVAL_ID
> 
> ATTR               - ATTR_ID, IDENTIFIER
> 
> ATTRVAL            - ATTRVAL_ID , ATTR_ID, DATA   ATTRVALDESC        -
> ATTRVAL_ID, VALUE, LANGUAGE_ID
> 
> PRODUCT            - PRODUCT_ID and some other non-relevant columns

查询返回多行。

DB2(V10.5)中上述查询的存储过程是什么?

两种方法在执行时间方面有何不同( 存储过程和连接)?

0 个答案:

没有答案