Does the Sql Server REPLACE function increase the estimated row size?
3
votes
1
answer
309
views
Analyzing a simple query, I noticed that the REPLACE function increases the estimated row size.
Look at the following query, executed on AdventureWorks:
select p.BusinessEntityID, REPLACE(p.FirstName, 'a', 'b') as X
from Person.Person p
The following is the execution plan. The estimated row size, starting from 65 B, goes up to 4015 B only applying the Compute Scalar component that is related to the REPLACE function.
Can anyone give an explanation about it?
The test has been done on Sql Server 2022.
Thanks in advance.

Asked by Alessandro Mortola
(83 rep)
Feb 16, 2023, 07:58 AM
Last activity: Feb 16, 2023, 12:23 PM
Last activity: Feb 16, 2023, 12:23 PM