简体   繁体   中英

Why my mdf file from new filegroup not growing?

I create a draft database with 2 tables: dbo. D and dbo. F , next I create a new filegroup for dbo. F and a file for this.

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. F with random binary data.

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. 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. I'm basing my assumption on ID being an INT column...

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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