So, we have a SQL table named Clients which has the following columns:
- UniqueId (nvarchar(200), not null)
- Data (nvarchar(max), null) - this one has JSON for each row(aprox. 30k-40k characters)
And we got a request to return to our user, UniqueId using the value from one of the parameters nested in Data JSON field (let's call it Value in this example)
We got something like this:
select UniqueId
from dbo.Clients
where JSON_VALUE(Data,'$.Parent.Child.ChildOfChild.Value') like 'Value'
But, as expected, table which has 20k+ rows and each row contains JSON in Data(with 30k-40k characters) takes a very long time to execute.
Our question is, is there any way to speed up this kind of query? Given the fact that we can't change the table design. Thanks in advance!