0

In order to store images in a SQL Server database, I am working with a naive table. The table's columns are: ImageID, X, Y, value.

Table sample data:

[1 1 1 255] %first image, pixel (1,1)
[1 1 2 100] %first image, pixel (1,2)
[1 2 1 100] %first image, pixel (2,1)
[1 2 2 0]
[2 1 1 100] %second image, pixel (1,1)
[2 1 2 10]

I choose this specific way for storing images for executing queries such as:

select count(value) 
from myTable 
where myTable.x = 10 and myTable.y = 15 and myTable.value > 10

The problem is that I am running out of storage - the table is getting too big. Do you have any suggestion for saving images more efficiently while maintaining the ability to executes queries like the mentioned above?

Thanks.

7
  • 1
    I'd suggest not putting images in a relational database. Commented Dec 15, 2016 at 20:17
  • you may consider looking into this post - stackoverflow.com/questions/416881/… Commented Dec 15, 2016 at 20:18
  • why are you storing images in DB, is there a specific reason? Commented Dec 15, 2016 at 20:37
  • 3
    What's a naive table? Commented Dec 15, 2016 at 20:38
  • I choose this specific way for storing images for executing queries as mentiond above Commented Dec 15, 2016 at 20:38

1 Answer 1

3

I really feel that a database is the wrong way to handle this problem. I would have, perhaps, a database of image locations and a server side component that can read the images from some sort of local store (i.e. a directory) and run something like ImageMagik to determine if a particular pixel in each image is a particular color. This post might give you some ideas in that direction.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.