Is it a good practice to save a base64 string on the Database?

痴心易碎 提交于 2020-01-02 01:21:07

问题


i'm developing an android application when the user can send a image to my webservice.

Currently on my WebService i get a Base64 string and save it in a table on my database.

My question: Is that a good practice? Because as far as i know the Base64 string is a heavy string. My concern is about the db performance, like when this table gets bigger than 10000...100000 records.
Or should i avoid this behavior?
Eg.: Isntead off store the Base64 string on the database, i could recover the image and save only the URL at my db.

Ps: The database is SqlServer


Thanks for the help guys


回答1:


To answer your question, I think it's not good practice.

It depends largely upon how you will use these images you will probably load. Then, remember (base64 encoding makes file sizes roughly 33% larger than their original binary representations). The best way would be writing the image and then saving its location in the database.

Check out this post as it maybe help.




回答2:


i think using base64 encoding is very useful for saving URLs in the database. The big size for transmitted image is not good idea and not necessary.



来源:https://stackoverflow.com/questions/32630809/is-it-a-good-practice-to-save-a-base64-string-on-the-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!