0

Hello guys i am working on an query and every thing is working fine except when i run a query more than 2-3 times this return timeout is there is something wrong in my query or this is server error kindly suggest me here is my query

SELECT   
    Category_Feature_Mapping.Feature_ID,
    Category_Feature_Mapping.Category_ID, 
    Option_Table.Option_ID,  
    Option_Table.Title, 
    Feature_Table.Title AS featuretitle, 
    Feature_Table.Type
FROM 
    Category_Feature_Mapping 
    INNER JOIN Feature_Table 
        ON Category_Feature_Mapping.Feature_ID = Feature_Table.Feature_ID
    INNER JOIN Option_Table 
        ON Feature_Table.Feature_ID = Option_Table.Feature_ID 
WHERE 
    Category_Feature_Mapping.Category_ID = @catid
    AND Feature_Table.Feature_ID=@feid
    AND Feature_Table.Feature_ID not in (SELECT
                                             Feature_ID 
                                         FROM
                                             Vendor_Value_Table 
                                         WHERE
                                             Vendor_ID=@venid)                       
GROUP BY
    Category_Feature_Mapping.Feature_ID,
    Category_Feature_Mapping.Category_ID, 
    Option_Table.Option_ID, 
    Option_Table.Title, 
    Feature_Table.Title,
    Feature_Table.Type
Hadi
  • 36,233
  • 13
  • 65
  • 124
user1870546
  • 57
  • 1
  • 3
  • 11

2 Answers2

0

may by a question of performance, try to replace "not in" by "not exists" like this

 AND not exists (
 SELECT * FROM Vendor_Value_Table vvt
 WHERE Feature_Table.Feature_ID =vvt.Feature_ID and vvt.Vendor_ID=@venid
 )     
Esperento57
  • 16,521
  • 3
  • 39
  • 45
0

try to append ";Connection Timeout=100" to you connectionstring for up your timeout

Esperento57
  • 16,521
  • 3
  • 39
  • 45