문제

I have a huge database and my search has been very slow.

In my database has a File table that I like to store to another ndf file?

Anyone ever done this?

Please help me

도움이 되었습니까?

해결책

You did not mention the database engine, so here is an example for MSSQL:

Create a new filegroup:

ALTER DATABASE YourDatabase ADD FILEGROUP FG_FilegroupName;

After that add a new file to the filegroup

ALTER DATABASE YourDatabase ADD FILE (
    NAME = FILE_LogicalName,
    FILENAME = 'Path\To\Data\File.ndf',
    SIZE = 54MB, -- This is the initial size of the file. If you can estimate the size of the file after moving your table, adjust this value to that value.
)

The next step is to drop the clustered index on the table (if exists), then create a new one on the new filegroup you created:

ALTER TABLE YourDatabase.schema.TableName
    ADD CONSTRAINT PK_SchemaName_TableName PRIMARY CLUSTERED (ColumnNames)
        ON [FG_FilegroupName]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top