• I compared execution plans

    with parameter 'VEH' and 'COM'

    and in both cases it is this step that is taking up all the resources:

    Index Scan (NonClustered)

    [prj_detail].[IXN_prj_detail__per_end_date__detail_type_ind__evc_code__evc_type_code]

    Cost: 91%

    Another pattern I noticed is that execution time heavily depends on the number on records returned.

    It runs from 2 to 12 seconds when 5-100 records returned.

    It runs 2.5 minutes when 7,000 are being returned.