sql server - Sql query times out. But, after renaming any index it works -
we have query, worked during years.
a few months ago started giving timeouts.
however, if rename index (adding character name) , run query again, works. day after day have same. every day rename index, query works again.
what's problem? how can solve issue? how renaming index solve time out problem?
these symptoms suggest suboptimal cached query plan being used due parameter sniffing. renaming index voids cached plan new 1 generated upon next use optimal query parameter values.
parameter sniffing can avoided going forward query hint option(recompile)
or option(optimze for...)
described in sql server documentation.
Comments
Post a Comment