English 中文(简体)
20KB以下的二进制数据:BLOB还是文件系统?
原标题:Binary data under 20KB : BLOB or filesystem?

我正在开发一个Web应用程序,用户可以将他/她的工作保存到服务器上。保存的数据以可变长度的二进制形式存储,其大小大多在20KB以下(有时略大于100KB)。数据经常会被更改/更新。

我在服务器上有2个选项来保存数据:作为BLOB(mysql)或作为文件系统,并参考存储在db服务器中的文件路径。我听说每个选项都有优缺点。

什么是我的最佳选择?

谢谢 (Xièxiè)

最佳回答

我可能会采用数据库方法。 速度差异不太可能很大,而我非常喜欢将所有数据存储在一个地方。 获得数据库的一致备份要比备份数据库,文件系统和相关数据(并保持一致性)容易得多

它还提供了统一的准入方法、一致的许可,并允许你在不设立单独服务的情况下远程接触。

话虽如此,如果你想以后搬迁的话,保持你的选择开放并不要把它过分地和数据库绑定可能会有所收益。

问题回答

我建议将它放在数据库中。为了避免经过数据库,建立一个用于存储和访问这些数据的特殊格式几乎没有意义。那么,如果应用程序的多个实例同时访问数据库怎么办(在Web应用程序中很可能出现的情况)?只要正确使用数据库,您就可以将这些担忧交由数据库引擎处理。而自制的文件格式则会让您陷入麻烦。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签