The database generally stores the path of resources. Relative paths are generally used in projects. Absolute paths should be rarely used. If you use relative paths, there will be basically no problems with project migration.
Image and video resources are placed on separate servers and accessed using separate domain names, such as img.xxx.com, so migrating the server will not affect it. Even if the path changes, it can be rewritten with rewrite.
It must be a separate server. The database stores links. If the value of a certain field in the database is too large, it will affect the query efficiency of the entire table.
1. As long as the directory structure does not change, it should be easy to change the path; 2. For pictures that are accessed frequently and can be made public, it is recommended to use storage services such as Qiniu. This will reduce server pressure on the one hand, and after CDN, access Faster too.
When I was studying database principles in school, the teacher repeatedly asked this question. I didn’t understand it at the time. Later, when I took JSP/Servlet as an elective, the teacher put everything he got into the database, and then I was confused. . .
The database generally stores the path of resources. Relative paths are generally used in projects. Absolute paths should be rarely used. If you use relative paths, there will be basically no problems with project migration.
Image and video resources are placed on separate servers and accessed using separate domain names, such as img.xxx.com, so migrating the server will not affect it. Even if the path changes, it can be rewritten with rewrite.
It must be a separate server. The database stores links. If the value of a certain field in the database is too large, it will affect the query efficiency of the entire table.
1. As long as the directory structure does not change, it should be easy to change the path;
2. For pictures that are accessed frequently and can be made public, it is recommended to use storage services such as Qiniu. This will reduce server pressure on the one hand, and after CDN, access Faster too.
When I was studying database principles in school, the teacher repeatedly asked this question. I didn’t understand it at the time. Later, when I took JSP/Servlet as an elective, the teacher put everything he got into the database, and then I was confused. . .
The path to store files in the database should not use absolute paths,