Owain, please check make sure it's not database/network latency, or some concurrent database backup/maintenance that is interfering with the performance.
Some query plans get optimized if you inline the parameters. For example WHERE Name LIKE @Search
has very poor performance, but if you inline a value like WHERE Name LIKE 'Leonardo%'
, Sql Server might now use indexes because the first characters of the name are known. If possible, try to rule out this hypothesis.
Also, could you tell us if the table is consumed via integration, or was it created in OutSystems? And are you using aggregates or writing SQL queries?