I have created a computed field for a json document like that:
...,
[vId] AS (CONVERT([bigint],json_value([Value],'$.Id'))) PERSISTED NOT NULL,
CONSTRAINT [PK_MyTable] PRIMARY KEY CLUSTERED
(
[vId] DESC
)
Then I run a simple query:
SELECT vId FROM MyTable WHERE vId = 100
After I checked the execution plan I was surprised to find out that after an index seek sql server performs Compute Scalar where it seems to calculate vId (is listed in Output List).
Shouldn't SQL Server already have access to the value since it is persisted?