Answer the question
In order to leave comments, you need to log in
What is the best way to store product images in a separate table or in the same table in JSON?
Actually the subject .. It seems like it’s more correct to store it in a separate table, but I can’t understand why this can be useful
Answer the question
In order to leave comments, you need to log in
For myself, in the end, I did not find any advantages in the JSON storage format.
I made a single table for pictures, and I link the necessary models through a polymorphic link.
Yes, this is 1 more query to the database, but it is easily cached.
There is an opinion that it is better to store pictures simply in the file system: access to them is faster and the DBMS will not strain due to unnecessary generation of network traffic.
This can be useful if you have one picture belonging to more than one product.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question