为什么一个空的数据库占用数兆字节的空间? [英] Why does an empty database take megabytes of space?

查看:93
本文介绍了为什么一个空的数据库占用数兆字节的空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试(嵌入式)Apache Derby DB时,我注意到一个没有表的新数据库大约需要1.7 MB的磁盘空间。

为什么呢?各种数据库引擎之间在这方面有显着差异吗?

解决方案

不同的数据库引擎之间会有区别。 p>

通常,将需要所有元数据表来跟踪真实表/视图/创建时在数据库中可能出现的其他任何内容,可能有些已分配的空间,用于添加表或开始进行事务时。



例如SQL Server(2000)的模型数据库占用约1.25MB的空间,其中0.5MB为空。该数据库是SQL Server中所有其他数据库的基础。


When experimenting with (embedded) Apache Derby DB, I noticed that a fresh database, with no tables in it, takes about 1.7 MB of disk space. It's quite a bit more than my common wisdom would expect.

Why is that? Are there significant differences in this between various database engines? Can this be controlled with some "block size" -like settings?

解决方案

There will be differences between different database engines.

Generally, there will be all the metadata tables that are needed to track the real tables/views/whatever else can appear in the database when they're created, possibly some pre-allocated space ready for when tables are added or when transactions start occurring.

e.g. the model database for SQL Server (2000) occupies ~1.25MB of space, of which 0.5MB is empty. This DB is the basis for all other databases in SQL server.

这篇关于为什么一个空的数据库占用数兆字节的空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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