Reputation: 903
I have a table which one of the columns with type [Data] (varbinary(max), not null). I saved one row, and I checked the size of the image size:
SELECT SUM(Datalength(Data)) FROM t_photo where id=2256 => 355249
When I execute the query:
select data from t_photo where id=2256
It takes about ~10 seconds
What can I do to lower this query time?
Upvotes: 4
Views: 3275
Reputation: 903
My solution was not to save the byte array of the image in th DB, but to store the image in the blob storage, and save in the db only the URL of this image
Upvotes: 1
Reputation: 5324
Index the table on id
. If that still takes more than a fraction of a second there might be blocking involved or extreme amounts of IO. Run sp_whoisactive
to see what it is.
Upvotes: 2