这句SQL语句如何优化,现在执行很慢很慢......
select column_oid,value from (
select a.column_oid,a.doc_oid, c.lable value
from f_item a,f_column b,f_refitem c
Where a.column_oid = b.column_oid
and b.ref_id != -1 and b.type !=5
and b.ref_id = c.ref_oid and a.value = c.value
and (a.doc_oid = ? or doc_oid in (select doc_oid from f_document where supdoc = ? ))
Union
select a.column_oid,a.doc_oid,a.value
from f_item a,f_column b
Where a.column_oid = b.column_oid And b.ref_id = -1
and (a.doc_oid = ? or a.doc_oid
in (select doc_oid from f_document where supdoc = ? ))
)
order by doc_oid