You are using a SQL Server database.
We removed unnecessary records because there were more records in the table than transaction logs.(DELETE statement)
However, the size of the mdf file did not change.
So I tried to compress it, but MSDN stated that compression cannot be compressed to a size smaller than the initial size of the database.
Here's the point, but would it be possible to reduce this initial size?
sql sql-server
Cite the code from Create Database | Microsoft Docs.
USE master;
GO
CREATE DATABASE Sales
ON
(NAME=Sales_dat,
FILENAME='C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSQL\DATA\saledat.mdf',
SIZE = 10,
MAXSIZE=50,
FILEGROWTH=5)
LOGON
(NAME=Sales_log,
FILENAME='C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSQL\DATA\salelog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB);
GO
When you run CREATE DATABASE
, you can specify SIZE
, MAXSIZE
, and FILEGROWTH
.
If you reduce the SIZE
value, you may be able to reduce the initial size, so please try it.See the Transact-SQL reference for more information.
© 2024 OneMinuteCode. All rights reserved.