sql server programming:
Hello !
I am using this query, my tables contains more then 900000 rows, and i
am getting result very slow. pl. help to optimize it .
GetDocumentsOfIndex is function whcih will return table.
select distinct document_id, cached_folder_id from rep_document where
document_id in ((select document_id from
dbo.GetDocumentsOfIndex(49910) where document_id not in (select
object_id from rep_object_index where index_field_id=49910))
INTERSECT (select document_id from dbo.GetDocumentsOfIndex(49920)
where document_id not in
(select object_id from rep_object_index where index_field_id=49920))
INTERSECT
(select document_id from dbo.GetDocumentsOfIndex(49921) where
document_id not in
(select object_id from rep_object_index where
index_field_id=49921))
INTERSECT
(select document_id from dbo.GetDocumentsOfIndex(49965) where
document_id not in
(select object_id from rep_object_index where
index_field_id=49965))
INTERSECT
(select document_id from dbo.GetDocumentsOfIndex(49970) where
document_id not in
(select object_id from rep_object_index where
index_field_id=49970))
INTERSECT
(select document_id from dbo.GetDocumentsOfIndex(49971) where
document_id not in
(select object_id from rep_object_index where
index_field_id=49971))
INTERSECT (select document_id from
dbo.GetDocumentsOfIndex(49972) where document_id not in
(select object_id from rep_object_index where
index_field_id=49972))
INTERSECT
(select document_id from dbo.GetDocumentsOfIndex(1078831) where
document_id not in
(select object_id from rep_object_index where
index_field_id=1078831))
INTERSECT
(select object_id from rep_object_index where
index_field_id=84201))
anil