websss
asked on
Querying SQL Server data stored as JSON in column - performance and tips
Hi
Currently I have the following columns
Analog1
Analog2
Analog1Raw
Analog2Raw
I now need to add upto 60 more analog columns, and have decided to switch to one column to store the analog data as
The data is only ever queried by 1 report, but I need the report to be very fast
Therefore I need help with the following
1. what data type should i store the data as in sql server
2. is sql any good at querying this type of JSON data direct
I'll want to do stuff like
i'm using .net framework 4.5 so can do other logic here to pull out data, but was hoping to query it directly if its performant
I'm using sql server 2014 on live, 2016 on dev, and we are planning an upgrade to 2017 on both environments.
Currently I have the following columns
Analog1
Analog2
Analog1Raw
Analog2Raw
I now need to add upto 60 more analog columns, and have decided to switch to one column to store the analog data as
[
{
"an1":2103,
"an1r":2220
},
{
"an2":5999,
"an2r":6000
},
etc..
]
The data is only ever queried by 1 report, but I need the report to be very fast
Therefore I need help with the following
1. what data type should i store the data as in sql server
2. is sql any good at querying this type of JSON data direct
I'll want to do stuff like
select jsonColumn.an1
where mydate between 2 dates
i'm using .net framework 4.5 so can do other logic here to pull out data, but was hoping to query it directly if its performant
I'm using sql server 2014 on live, 2016 on dev, and we are planning an upgrade to 2017 on both environments.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In a .NET application, you can add the Newtonsoft.Json NuGet package and then Query the JSON with LINQ.