简体   繁体   English

为什么我的新文件组中的mdf文件没有增长?

[英]Why my mdf file from new filegroup not growing?

I create a draft database with 2 tables: dbo. 我用2个表创建了一个数据库草稿:dbo。 D and dbo. D和dbo。 F , next I create a new filegroup for dbo. F ,接下来我为dbo创建一个新的文件组。 F and a file for this. F和一个文件。

USE DEV

ALTER DATABASE DEV
    ADD FILEGROUP [BLOB] 

ALTER DATABASE DEV
ADD FILE
(
    NAME= 'blob',
    FILENAME = 'D:\MS SQL\DB\blob.mdf'
)
TO FILEGROUP [BLOB]

Next, I drop clustered index and recrete it, specifying a filegroup name. 接下来,我删除聚簇索引并重新创建它,并指定文件组名称。

    ALTER TABLE F
    DROP CONSTRAINT [F_PK] WITH (MOVE TO BLOB)

    ALTER TABLE F
    ADD CONSTRAINT [F_PK] PRIMARY KEY CLUSTERED 
    ( 
        ID 
    ) 
    WITH (IGNORE_DUP_KEY = OFF) ON BLOB

   CREATE UNIQUE CLUSTERED INDEX F_PK
   ON dbo.F(ID)
   WITH DROP_EXISTING
   ON [BLOB]

Next, I create more then 2k INSERT's queries and full in dbo. 接下来,创建2k INSERT的查询,并在dbo中进行更多的查询。 F with random binary data. F具有随机二进制数据。

Question! 题!

Why on this picture my new filegroup's file weighs so little unlike in the default filegroup's file? 为什么在这张图片上我的新文件组的文件与默认文件组的文件相比,重量如此之小?

在此处输入图片说明

Without seeing the full schema of your tables... you only have ID in your clustered index which means that all of the data you inserted is still in your primary filegroup. 没有看到表的完整架构……您在聚集索引中仅具有ID,这意味着您插入的所有数据仍位于主文件组中。 The only thing in blob is the index of your ID values which I would assume is not going to be anywhere near as large as the binary data you are inserting. blob唯一的一件事就是ID值的索引,我认为它的索引大小不会比您要插入的二进制数据大。 I'm basing my assumption on ID being an INT column... 我基于ID为INT列的假设...

This, of course, is irrelevant if ID is the column in which you are storing your binary data, but I assume that's not the case if you're using it as a PK and clustered index. 当然,如果ID是存储二进制数据的列,则这无关紧要,但是我假设如果将其用作PK和聚簇索引,则不是这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM