SQL Server table with 4,000,000 rows is 40GBSlow Performance Inserting Few Rows Into Huge TablePAD_INDEX and FILLFACTOR on clustered Identity indexParent-Child Tree Hierarchical ORDERMigrating from SQL Server to MySQL using MySQL Workbench toolgood strategy for big tables and archiving in sql server 2012Is Primary Key Non Clustered recommended?Update Table from SP in SSISdeteriorating stored procedure running timesWhat are the current best practices concerning varchar sizing in SQL Server?SQL Server 2012 Aggressive Over-Indexing when i run sp_BlitzIndex

How would two worlds first establish an exchange rate between their currencies

Is BitLocker useful in the case of stolen laptop?

Where does the expression "triple-A" comes from?

I see your BIDMAS and raise you a BADMIS

How to create a list of dictionaries from a dictionary with lists of different lengths

Are programming languages necessary/useful for operations research practitioner?

How do I politely hint customers to leave my store, without pretending to need leave store myself?

CBP interview, how serious should I take it?

Are there any space probes or landers which regained communication after being lost?

Two different colors in an Illustrator stroke / line

Are Democrats more likely to believe Astrology is a science?

Webpage with a preload animation using JavaScript setTimeout

Is there a basic list of ways in which a low-level Rogue can get advantage for sneak attack?

Writing a love interest for my hero

How was Carlo's plan supposed to work?

Should I use my toaster oven for slow roasting?

Do any aircraft carry boats?

On the origin of "casa"

Why are some Mac apps not available on AppStore?

Do Milankovitch Cycles fully explain climate change?

Are there take-over requests in aviation?

How important is the DUP support (at the moment) to the current ruling party in UK?

Is there a sentence that begins with “them”?

Why should I always enable compiler warnings?



SQL Server table with 4,000,000 rows is 40GB


Slow Performance Inserting Few Rows Into Huge TablePAD_INDEX and FILLFACTOR on clustered Identity indexParent-Child Tree Hierarchical ORDERMigrating from SQL Server to MySQL using MySQL Workbench toolgood strategy for big tables and archiving in sql server 2012Is Primary Key Non Clustered recommended?Update Table from SP in SSISdeteriorating stored procedure running timesWhat are the current best practices concerning varchar sizing in SQL Server?SQL Server 2012 Aggressive Over-Indexing when i run sp_BlitzIndex






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I have been trying to figure out why our production database has grown so much recently and have found the cause to be an audit table. We are going to archive the table to fix the problem but I just wanted to check if the size of the table looked normal for a large SQL server table like this.
It has 4,000,000 rows with the following structure...



Name Type Nullable
AuditLogId bigint no
UserName nvarchar no
TimeOfChange datetime no
ObjectName nvarchar no
ChangeName nvarchar no
RecordId int yes
OriginalValues nvarchar yes
ResultingValues nvarchar no


With a primary key on the AuditLogId



ALTER TABLE [dbo].[AuditLog] ADD CONSTRAINT [PK_AuditLog] PRIMARY KEY CLUSTERED 
(
[AuditLogId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO


There is also a foreign key to the record that was updated on RecordId.
The nvarchar fields seem to have up to 12,0000 characters with an average of around 8000 characters.
The table is currently 40GB in size, does that seem right? I can provide more information on the table if that question can’t be answered with what I have posted above.



Thanks










share|improve this question



















  • 2





    Have you checked index fragmentation? Does this table have lots of inserts and deletes? If you are not maintaining the indexes and lots of data gets inserted and later deleted, the index structure can become rather lopsided. Rebuilding the indexes as a whole to properly distribute the data could be helpful. I don't see any index information in your post so I didn't post this as an answer in case this is not your problem.

    – G.Smith
    9 hours ago


















3















I have been trying to figure out why our production database has grown so much recently and have found the cause to be an audit table. We are going to archive the table to fix the problem but I just wanted to check if the size of the table looked normal for a large SQL server table like this.
It has 4,000,000 rows with the following structure...



Name Type Nullable
AuditLogId bigint no
UserName nvarchar no
TimeOfChange datetime no
ObjectName nvarchar no
ChangeName nvarchar no
RecordId int yes
OriginalValues nvarchar yes
ResultingValues nvarchar no


With a primary key on the AuditLogId



ALTER TABLE [dbo].[AuditLog] ADD CONSTRAINT [PK_AuditLog] PRIMARY KEY CLUSTERED 
(
[AuditLogId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO


There is also a foreign key to the record that was updated on RecordId.
The nvarchar fields seem to have up to 12,0000 characters with an average of around 8000 characters.
The table is currently 40GB in size, does that seem right? I can provide more information on the table if that question can’t be answered with what I have posted above.



Thanks










share|improve this question



















  • 2





    Have you checked index fragmentation? Does this table have lots of inserts and deletes? If you are not maintaining the indexes and lots of data gets inserted and later deleted, the index structure can become rather lopsided. Rebuilding the indexes as a whole to properly distribute the data could be helpful. I don't see any index information in your post so I didn't post this as an answer in case this is not your problem.

    – G.Smith
    9 hours ago














3












3








3








I have been trying to figure out why our production database has grown so much recently and have found the cause to be an audit table. We are going to archive the table to fix the problem but I just wanted to check if the size of the table looked normal for a large SQL server table like this.
It has 4,000,000 rows with the following structure...



Name Type Nullable
AuditLogId bigint no
UserName nvarchar no
TimeOfChange datetime no
ObjectName nvarchar no
ChangeName nvarchar no
RecordId int yes
OriginalValues nvarchar yes
ResultingValues nvarchar no


With a primary key on the AuditLogId



ALTER TABLE [dbo].[AuditLog] ADD CONSTRAINT [PK_AuditLog] PRIMARY KEY CLUSTERED 
(
[AuditLogId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO


There is also a foreign key to the record that was updated on RecordId.
The nvarchar fields seem to have up to 12,0000 characters with an average of around 8000 characters.
The table is currently 40GB in size, does that seem right? I can provide more information on the table if that question can’t be answered with what I have posted above.



Thanks










share|improve this question














I have been trying to figure out why our production database has grown so much recently and have found the cause to be an audit table. We are going to archive the table to fix the problem but I just wanted to check if the size of the table looked normal for a large SQL server table like this.
It has 4,000,000 rows with the following structure...



Name Type Nullable
AuditLogId bigint no
UserName nvarchar no
TimeOfChange datetime no
ObjectName nvarchar no
ChangeName nvarchar no
RecordId int yes
OriginalValues nvarchar yes
ResultingValues nvarchar no


With a primary key on the AuditLogId



ALTER TABLE [dbo].[AuditLog] ADD CONSTRAINT [PK_AuditLog] PRIMARY KEY CLUSTERED 
(
[AuditLogId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
GO


There is also a foreign key to the record that was updated on RecordId.
The nvarchar fields seem to have up to 12,0000 characters with an average of around 8000 characters.
The table is currently 40GB in size, does that seem right? I can provide more information on the table if that question can’t be answered with what I have posted above.



Thanks







sql-server performance database-size






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 9 hours ago









HoodyHoody

1353 bronze badges




1353 bronze badges










  • 2





    Have you checked index fragmentation? Does this table have lots of inserts and deletes? If you are not maintaining the indexes and lots of data gets inserted and later deleted, the index structure can become rather lopsided. Rebuilding the indexes as a whole to properly distribute the data could be helpful. I don't see any index information in your post so I didn't post this as an answer in case this is not your problem.

    – G.Smith
    9 hours ago













  • 2





    Have you checked index fragmentation? Does this table have lots of inserts and deletes? If you are not maintaining the indexes and lots of data gets inserted and later deleted, the index structure can become rather lopsided. Rebuilding the indexes as a whole to properly distribute the data could be helpful. I don't see any index information in your post so I didn't post this as an answer in case this is not your problem.

    – G.Smith
    9 hours ago








2




2





Have you checked index fragmentation? Does this table have lots of inserts and deletes? If you are not maintaining the indexes and lots of data gets inserted and later deleted, the index structure can become rather lopsided. Rebuilding the indexes as a whole to properly distribute the data could be helpful. I don't see any index information in your post so I didn't post this as an answer in case this is not your problem.

– G.Smith
9 hours ago






Have you checked index fragmentation? Does this table have lots of inserts and deletes? If you are not maintaining the indexes and lots of data gets inserted and later deleted, the index structure can become rather lopsided. Rebuilding the indexes as a whole to properly distribute the data could be helpful. I don't see any index information in your post so I didn't post this as an answer in case this is not your problem.

– G.Smith
9 hours ago











1 Answer
1






active

oldest

votes


















11
















You have 4,000,000 rows and one of the columns averages 8,000 characters (16,000 bytes, I assume).



SELECT CONVERT(bigint,4000000) * /* b */ 16000 / /*kb*/ 1024 / /*mb*/ 1024;
------
61,035


If your stats are accurate, I'd expect this table to be 61 GB. (I wonder if you mean 8,000 bytes, not 8,000 characters, in which case I'd expect > 30 GB.)



Other factors include:



  • data in other columns I didn't account for in the above calculation

  • additional indexes

  • fill factor > 0 and < 100

  • fragmentation and space still occupied by deleted rows or page splits





share|improve this answer



























  • Thank you Aaron, that explains the size perfectly

    – Hoody
    9 hours ago













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "182"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f247347%2fsql-server-table-with-4-000-000-rows-is-40gb%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









11
















You have 4,000,000 rows and one of the columns averages 8,000 characters (16,000 bytes, I assume).



SELECT CONVERT(bigint,4000000) * /* b */ 16000 / /*kb*/ 1024 / /*mb*/ 1024;
------
61,035


If your stats are accurate, I'd expect this table to be 61 GB. (I wonder if you mean 8,000 bytes, not 8,000 characters, in which case I'd expect > 30 GB.)



Other factors include:



  • data in other columns I didn't account for in the above calculation

  • additional indexes

  • fill factor > 0 and < 100

  • fragmentation and space still occupied by deleted rows or page splits





share|improve this answer



























  • Thank you Aaron, that explains the size perfectly

    – Hoody
    9 hours ago















11
















You have 4,000,000 rows and one of the columns averages 8,000 characters (16,000 bytes, I assume).



SELECT CONVERT(bigint,4000000) * /* b */ 16000 / /*kb*/ 1024 / /*mb*/ 1024;
------
61,035


If your stats are accurate, I'd expect this table to be 61 GB. (I wonder if you mean 8,000 bytes, not 8,000 characters, in which case I'd expect > 30 GB.)



Other factors include:



  • data in other columns I didn't account for in the above calculation

  • additional indexes

  • fill factor > 0 and < 100

  • fragmentation and space still occupied by deleted rows or page splits





share|improve this answer



























  • Thank you Aaron, that explains the size perfectly

    – Hoody
    9 hours ago













11














11










11









You have 4,000,000 rows and one of the columns averages 8,000 characters (16,000 bytes, I assume).



SELECT CONVERT(bigint,4000000) * /* b */ 16000 / /*kb*/ 1024 / /*mb*/ 1024;
------
61,035


If your stats are accurate, I'd expect this table to be 61 GB. (I wonder if you mean 8,000 bytes, not 8,000 characters, in which case I'd expect > 30 GB.)



Other factors include:



  • data in other columns I didn't account for in the above calculation

  • additional indexes

  • fill factor > 0 and < 100

  • fragmentation and space still occupied by deleted rows or page splits





share|improve this answer















You have 4,000,000 rows and one of the columns averages 8,000 characters (16,000 bytes, I assume).



SELECT CONVERT(bigint,4000000) * /* b */ 16000 / /*kb*/ 1024 / /*mb*/ 1024;
------
61,035


If your stats are accurate, I'd expect this table to be 61 GB. (I wonder if you mean 8,000 bytes, not 8,000 characters, in which case I'd expect > 30 GB.)



Other factors include:



  • data in other columns I didn't account for in the above calculation

  • additional indexes

  • fill factor > 0 and < 100

  • fragmentation and space still occupied by deleted rows or page splits






share|improve this answer














share|improve this answer



share|improve this answer








edited 9 hours ago

























answered 9 hours ago









Aaron BertrandAaron Bertrand

161k19 gold badges322 silver badges527 bronze badges




161k19 gold badges322 silver badges527 bronze badges















  • Thank you Aaron, that explains the size perfectly

    – Hoody
    9 hours ago

















  • Thank you Aaron, that explains the size perfectly

    – Hoody
    9 hours ago
















Thank you Aaron, that explains the size perfectly

– Hoody
9 hours ago





Thank you Aaron, that explains the size perfectly

– Hoody
9 hours ago


















draft saved

draft discarded















































Thanks for contributing an answer to Database Administrators Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f247347%2fsql-server-table-with-4-000-000-rows-is-40gb%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480