Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Giant Logfiles (ldf) during loading data into a Memory Optimized table Expand / Collapse
Author
Message
Posted Monday, August 26, 2013 9:06 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, October 31, 2014 8:33 AM
Points: 6, Visits: 165
Hello everyone,

I try to load data into a memOpt table (INSERT INTO ... SELECT ... FROM ...). The source table has a size about 1 Gb and 13 Mio Rows. During this load the LDF File grows to size of 350 GB (until the space if the disk is run out of space). The Server has about 110 GB Memory for the SQL Server reserved. The tempdB doesn't grow. The Bucket Size in the create statement has a size of 262144. The Hash key as 4 fields`(2 fields have the datatype int,1 has smallint, 1 has varchar(200). ) The disk for the datafiles has still space for the datafiles (incl. the hekaton files).

Can anyone guide how can I reduce the size of the ldf files during the load of the data ?
Post #1488414
Posted Monday, August 26, 2013 9:11 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 7:37 AM
Points: 13,230, Visits: 12,707
I would recommend breaking this into batches of 10k rows or so. A single insert with 13 million rows is going to kill your logs. This is one of those times that the dreaded cursor or while loop is actually going to increase your performance.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1488419
Posted Monday, August 26, 2013 11:18 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 12:13 PM
Points: 10,342, Visits: 13,351
Sean Lange (8/26/2013)
I would recommend breaking this into batches of 10k rows or so. A single insert with 13 million rows is going to kill your logs. This is one of those times that the dreaded cursor or while loop is actually going to increase your performance.


+1 because even actions on memory-optimized tables are logged unless you specify non-durable. http://technet.microsoft.com/en-us/library/dn133174(v=sql.120).aspx




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #1488468
Posted Monday, October 14, 2013 4:57 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, March 4, 2014 8:34 AM
Points: 43, Visits: 178
Jack Corbett (8/26/2013)
Sean Lange (8/26/2013)
I would recommend breaking this into batches of 10k rows or so. A single insert with 13 million rows is going to kill your logs. This is one of those times that the dreaded cursor or while loop is actually going to increase your performance.


+1 because even actions on memory-optimized tables are logged unless you specify non-durable. http://technet.microsoft.com/en-us/library/dn133174(v=sql.120).aspx


+2 With above suggestion iwould also suggest to change the recovery model of the database to simple if you can, if not take trasaction log backup in b/w the batches to free up the .ldf file. Some indexes can also be disabled during that load to avoid lots of updates (Indexes can be rebuild again after the load).
Overall Plan your activity accordingly [I hope i am not wrong with the suggestions i gave]
Post #1504398
Posted Monday, October 14, 2013 5:07 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 7:57 AM
Points: 13,545, Visits: 11,358
sql-noob (10/14/2013)
Jack Corbett (8/26/2013)
Sean Lange (8/26/2013)
I would recommend breaking this into batches of 10k rows or so. A single insert with 13 million rows is going to kill your logs. This is one of those times that the dreaded cursor or while loop is actually going to increase your performance.


+1 because even actions on memory-optimized tables are logged unless you specify non-durable. http://technet.microsoft.com/en-us/library/dn133174(v=sql.120).aspx


+2 With above suggestion iwould also suggest to change the recovery model of the database to simple if you can, if not take trasaction log backup in b/w the batches to free up the .ldf file. Some indexes can also be disabled during that load to avoid lots of updates (Indexes can be rebuild again after the load).
Overall Plan your activity accordingly [I hope i am not wrong with the suggestions i gave]


Are you sure you can disable the index on an in-memory table?




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1504401
Posted Monday, October 14, 2013 5:32 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, March 4, 2014 8:34 AM
Points: 43, Visits: 178
My bad, the suggestion was for general ETL operations (Large one).
Forgot that it's hekaton.
Post #1504409
Posted Monday, October 14, 2013 5:59 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, October 31, 2014 8:33 AM
Points: 6, Visits: 165
Hello,

sorry I didn't mentioned, that I have already set the log model of the database to simple. Even with that configuration the Log growths in this way. I tried the suggestion with divide the data into smaller Batches. I managed that with creating a SSIS Package. In the properties of the 'data flow Task - OLE DB destitnation' it is possible to divide the load into Batches of 10K size. After that the copy of the data into the InMem Table works, without any unnormal growths of the log.

The exciting question will be, how SQL Server will handle this in a Environment, where it isn't possible to set the recovery model to simple (Mirrored Databases / Logshipped Databases). I hope in the RTM will be a improvent of that behavior.
Post #1504415
Posted Wednesday, October 23, 2013 12:08 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, October 31, 2014 8:33 AM
Points: 6, Visits: 165
The problem is fixed in the CTP 2, according this annoucement.

see:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/c69d826d-0994-44bf-8c17-96d5ff805dad/sql14-hekaton-loading-causes-log-space-to-blow-up?forum=sql14inmemtech
Post #1507468
Posted Wednesday, October 23, 2013 8:08 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 12:13 PM
Points: 10,342, Visits: 13,351
Fecker Elmar (10/23/2013)
The problem is fixed in the CTP 2, according this annoucement.

see:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/c69d826d-0994-44bf-8c17-96d5ff805dad/sql14-hekaton-loading-causes-log-space-to-blow-up?forum=sql14inmemtech


You are still going to have log growth if you load a large amount of data in a single transaction unless you use non-durable table (schema only persisted) as all the inserts will still be logged for durability. I think the best practices for large ETL processes will still hold true for In-Memory OLTP as well.




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #1507636
Posted Wednesday, October 30, 2013 11:38 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 7:12 AM
Points: 31,284, Visits: 15,746
In production, you would load in batches, and run log backups during the load to keep the size manageable.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1509895
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse