• It was 1 query. I split OR part mentioned below into 2 queries and used union. Now it is performing 65% better then earlier.

    but still consuming a lot of time. I think now only an Index can help.

    Earlier query was having:

    (isnull(10172,0)=0

    or

    pd.activity_id = 10172

    )