This shape can be interesting in most cases as optimization. In general you need the user data in various contexts but not the photo, so it may be that having only the data can read several of them in a single access to the storage medium that is usually quite slow. If you have everything together it is likely that each user will cause at least one access, even if you do not take the photo(s)).
But I am speculating, it may be that Postgresql has an optimization that does not cause this effect, then I do not see much advantage. In fact without knowing the actual implementation of Postgresql can not guarantee anything, everything can happen, so always need to test.
For example, it would be possible for a user access to be curled in the memory with photo because it is together, and occupying more space in the memory could affect the overall performance because it has less curly data. I doubt this will actually happen, but it’s a possibility.
It may be that Postgresql has a specific motivation, some database systems are even bad for putting images inside it. With a reference to the location that stated this could help give a more precise answer.
From the conceptual point of view there is no problem at all together, by optimization it can be very interesting to separate.
If you have a set of images, including the profile photo, related to the same user you have to check if there is any justification in your project to need to separate the profile photo from the other images. In terms of database there is no reason to separate.
– anonimo
@anonimo understood, in terms of the project does not have a justification, what I was thinking was if separating would help in the efficiency of the bank and etc. Thank you very much for the help!! I guess I’d have no problem doing everything together anyway!
– Arthur Oliveira
Early optimization is the mother of all evils. Do your project and implement it. If during the tests you find that there is a performance problem then study the most used queries and evaluate if some kind of table division can optimize them.
– anonimo
@Arthuroliveira Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site.
– Maniero