douluanji8752 2014-08-03 14:25
浏览 53
已采纳

即使没有访问,单个大表也会减慢数据库的速度吗?

If you had a table containing thumbnails for a small part of a website that is not regularly accessed, would the database run normally (assuming the large table isn't being accessed), or would there be an overall loss of speed?

For example, I found my free webhost offers unlimited database size but only 10,000 files (hence why I'm storing thumbnails in the database), so I'm curious if I'd be able to leave in a few unused values - so in the case of a duplicate, it'll find the matching hash and re-link to the old value, or would it be a lot better just removing the row?

  • 写回答

2条回答 默认 最新

  • dongmian5325 2014-08-03 14:37
    关注

    Databases ultimately store data on disk. Database performance is not really affected by disk space and disk usage (except in certain extreme cases, such as running out of disk space or severely fragmenting the disk space, neither of which is an issue for your question).

    Database performance is driven by what happens in memory, particularly by the time taken to load data from disk into memory. There are various data caches in memory, such as the page cache. When a page is not available, then the engine has to fetch it from disk -- and that takes time.

    A table that just sits around on disk never being used should not use any space in memory. That means that other tables used by other queries can fill up memory, with no problem. Of course, when that table is modified, then one or more pages will be loaded into memory. From what you describe, this would not use up much of the in-memory cache.

    The basic answer to your question is that a large table hanging around on disk will not affect performance. Modifications to the table would, of course, affect performance because that work would be done by processors and memory that could be used for other queries.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?