I am getting below warnings in execution plan. Please some provide suggestions on how to resolve this error.
Type conversion in expression (CONVERT(int,STRING_SPLIT.[value],0)) may affect "CardinalityEstimate" in query plan choice
Above warning in seen for below SQL Statement
SELECT TE.value AS GroupID
,ISNULL(TM.TotalCount, 0) AS GroupCount
FROM #tblWorkQueueDocuemnt TM
RIGHT OUTER JOIN (
SELECT CONVERT(INT, value) AS value
FROM STRING_SPLIT('1,2,3,4', ',')
) TE ON TM.GroupID = TE.value
#tblWorkQueueDocuemnt : Statement for Create Table. CREATE TABLE #tblWorkQueueDocuemnt (GroupID INT, TotalCount INT)
It's an old thing they have whenever they have an implicit conversion.
In instances where you are doing an implicit conversion on a field, it may not be able to use the index. Similar to if you did an explicit CAST or CONVERT on it.
If it's running fine and has no problems, ignore it.
See e.g., https://www.brentozar.com/archive/2018/10/we-need-to-talk-about-the-warnings-in-your-query-plans/
In your case, you could explicitly cast the values after the string_split as ints, if desired. It is technically cleaner but probably won't improve performance at all.