数据库和fileinfo中的时间差异 [英] Difference time in database and fileinfo

查看:80
本文介绍了数据库和fileinfo中的时间差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想知道下面的女巫是否更好,性能更好?

1-存储数据库中的文件持续时间并获取它

2 - 从FileInfo类获取文件持续时间

谢谢

Hi I want to know witch of the below is better and good performance?
1- store file duration in data base and fetch it
2- get file duration from FileInfo class
Thanks

推荐答案

如果你的意思是文件大小,那么这是一个有点愚蠢的问题 - 它是将取决于太多因素。首先,您是从数据库的同一行中获取其他内容吗?例如,如果您已经从数据库中获取文件路径,那么将文件大小添加到该请求需要花费额外的时间,而从文件夹结构中单独获取它将增加搜索时间等等。这可能是一个更长时间的操作。



其次,存在准确性问题:大小必须是最新的?如果文件在写入数据库的文件信息与读出信息之间不变,那么问题就不存在了。但是......如果用户可以在信息写入后以任何方式更新文件,那么它很快就会变得无用。



对不起,我们无法制作对你的决定 - 你必须仔细研究你想要实现的目标和工作。
If you mean the file size, then it's a bit of a silly question - it's going to depend on too many factors. Firstly, are you fetching anything else from the same row of the database? For example, if you are fetching the file path from the DB already, then it will take a trivial extra amount of time to add the file size to that request, while fetching it separately from the folder structure will add seek times and so forth making that likely to be a longer operation.

Secondly, there is the accuracy problem: how up-to-date does the size have to be? If the file is unchanging between the file info being written to the DB and when the info is read out, then it isn;t a problem. But...if the user can update the file in any way after the info is written, then it can quickly become useless.

Sorry, we can't make that decision for you - you will have to look at exactly what you are trying to achieve and work from there.


这篇关于数据库和fileinfo中的时间差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆