我的初始数据库大小应该是多少

发布于 2024-09-09 04:52:33 字数 109 浏览 5 评论 0原文

我正在将数据库从 MySQL 迁移到 SQLServer。创建数据库时,初始大小应该设置为多少?我知道导入的数据库的大小约为 130MB,但会增长。初始大小应该是 130MB 还是应该采用默认的 2MB?

I'm moving a database from MySQL to SQLServer. When creating the database, what should I set the initial size to? I know the size of the imported database will be about 130MB but will grow. Should 130MB be the initial size or should I just take the default of 2MB?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

自找没趣 2024-09-16 04:52:33

您应该将其设置为适合您的数据的正确大小,只要文件需要增长,您就会受到性能影响。

这取决于它增长的速度,我会说 150MB,自动增长 10%。

MSDN 上有值得一读的建议。

You should make it the correct size to fit your data, you will get a performance hit whenever the file needs to grow.

It depends how fast it would grow, I would say 150MB with 10% Autogrowth.

There is advice on the MSDN that is worth a read.

老娘不死你永远是小三 2024-09-16 04:52:33

将其设置为至少您当前的大小,可能具有适当的缓冲区,以便在迁移过程中立即增长。根据增长率,我会执行以下操作:

初始:150MB(如果大小不是问题,则为 200MB)

自动增长:是

自动增长大小:从 5MB 到 25MB 的任意位置(取决于您的增长预期)

Set it to at least your current size, probably with a decent buffer for immediate growth during the migration. Depending on growth rate I would do something like:

Initial: 150MB (or 200MB if size isnt an issue)

Autogrowth: yes

Autogrowth Size: anywhere from 5MB to 25MB (depending on your growth expectations)

星星的軌跡 2024-09-16 04:52:33
USE MASTER;
GO
CREATE DATABASE StackOverflowDatabase
ON 
( NAME = 'StackOverflowDatabase',
    FILENAME = 'C:\Program Files\Microsoft SQL Server\Your version\MSSQL\DATA\SO_db.mdf',
    SIZE = 200MB,
    MAXSIZE = UNLIMITED,
    FILEGROWTH = 50MB )
LOG ON
( NAME = 'StackOverflowDatabase_log',
    FILENAME = 'C:\Program Files\Microsoft SQL Server\Your version\MSSQL\DATA\SO_db.ldf',
    SIZE = 20MB,
    MAXSIZE = 50MB,
    FILEGROWTH = 10MB ) ;
GO
USE MASTER;
GO
CREATE DATABASE StackOverflowDatabase
ON 
( NAME = 'StackOverflowDatabase',
    FILENAME = 'C:\Program Files\Microsoft SQL Server\Your version\MSSQL\DATA\SO_db.mdf',
    SIZE = 200MB,
    MAXSIZE = UNLIMITED,
    FILEGROWTH = 50MB )
LOG ON
( NAME = 'StackOverflowDatabase_log',
    FILENAME = 'C:\Program Files\Microsoft SQL Server\Your version\MSSQL\DATA\SO_db.ldf',
    SIZE = 20MB,
    MAXSIZE = 50MB,
    FILEGROWTH = 10MB ) ;
GO
行雁书 2024-09-16 04:52:33

200 MB 和 50 MB 自动增长是正确的解决方案。请记住为 tempdb 使用单独的驱动器,如果可能的话,如果您需要更好的性能,请将日志与数据放在不同的磁盘上。另外,请记住,您的数据可能有 130 MB,但您还需要考虑索引以及它们将消耗多少空间。另外,即使您有 200MB 的数据文件,您的备份文件也会小得多,这通常是在谈论像这样的小型数据库时真正需要考虑的空间问题。

200 MB with a 50 MB auto-grow is the right solution. Remember to use separate drives for tempdb, and if possible put your logs on different disks from your data too if you need better performance. Also, remember that your data may be 130 MB, but you need to think of your indexes too and how much space they'll consume. Also, even if you have a 200MB data file, your backups files will be much smaller, which is often where the real space concern is when talking about small DBs like this.

墨小沫ゞ 2024-09-16 04:52:33

您应该了解的一件事是数据库的增长速度有多快。

如果增长率很小(假设为 1 MB/周)

对于 MDF,

将初始大小设置为 200 MB

将自动增长设置为 100 MB(即初始大小的 50%)

对于 LDF,

将初始大小设置为 20 -50 MB(这是 MDF 文件初始大小的 10-25%)

将自动增长设置为 10-25 MB(这是 LDF 文件初始大小的 50%)

避免使用 % 进行自动增长,因为这是不可预测的。例如,如果您指定自动增长的百分比并且数据库大小增长到 300MB,则这意味着 30 MB。如果您的数据库大小增长到 500 MB,这意味着 50 MB。另一方面,如果您使用 MB,那么您可以放心,数据库将始终增加您设置的 MB 量。

One thing you should find out is how fast the DB is growing.

If the growth rate is small (let's say 1 MB/week)

For the MDF,

Set initial size to 200 MB

Set auto-growth to 100 MB (which is 50% of the initial size)

For the LDF,

Set initial size to 20-50 MB (which is 10-25% of the initial size of the MDF file)

Set auto-growth to 10-25 MB (which is 50% of the initial size of the LDF file)

Avoid using % for auto-growth because it is unpredictable. For instance, if you specify percentage for your auto-growth and the DB size grows to 300MB than this means 30 MB. If your DB size grows to 500 MB this means 50 MB. On the other hand, if you use MB then you are assured that the DB will always grow the amount of MB you set.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文