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

Internals of data insertion into the table Expand / Collapse
Author
Message
Posted Tuesday, September 25, 2012 12:50 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Wednesday, September 10, 2014 12:22 AM
Points: 415, Visits: 1,587
Hi,

When we insert the data into a table, what happened exactly(process)?

How the data will be inserted? For any modifications sql server uses t-log right? How the t-log will be committed to data pages?


Thanks,





Post #1363816
Posted Tuesday, September 25, 2012 1:51 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, January 26, 2013 2:59 AM
Points: 199, Visits: 240
The transaction log is used for all modifications to guarantee atomicity, durability and consistency. Read Gail's thorough article.

http://www.sqlservercentral.com/articles/Administration/64582/
Post #1363841
Posted Tuesday, September 25, 2012 2:52 AM


SSC-Dedicated

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

Group: General Forum Members
Last Login: Today @ 3:49 PM
Points: 39,886, Visits: 36,233
The transaction log records aren't committed to data pages. The data modification is made to the data pages (in memory) and then logged into the transaction log. The only time you get replay from the log is in database recovery or restores (or on the mirror DB in database mirroring).


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1363861
Posted Tuesday, September 25, 2012 3:24 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Wednesday, September 10, 2014 12:22 AM
Points: 415, Visits: 1,587
GilaMonster (9/25/2012)
The transaction log records aren't committed to data pages. The data modification is made to the data pages (in memory) and then logged into the transaction log. The only time you get replay from the log is in database recovery or restores (or on the mirror DB in database mirroring).



The data modification is made to the data pages (in memory) and then logged into the transaction log.

That means
1. Sql server fetches the table related data pages to memory (What is the memory in this case is it RAM?)
Q. How many pages will be fetched to Memory?
Q2. How does server knows that the pages are related to a table?

if i am wrong can u correct me, Can you tell me the process of insertion?

Thanks alot


Post #1363876
Posted Tuesday, September 25, 2012 4:25 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 5:46 AM
Points: 13,752, Visits: 28,148
There are scads and scads of processes that take place when you insert data. I'd suggest getting a copy of Kalen Delaney's book SQL Server Internals. That covers the process in wonderful detail much better than you're going to get in a simple forum post.

May I ask, what specifically are you trying to understand about it? Are you hitting some type of problem?


----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1363918
Posted Tuesday, September 25, 2012 4:36 AM


SSC-Dedicated

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

Group: General Forum Members
Last Login: Today @ 3:49 PM
Points: 39,886, Visits: 36,233
SQL* (9/25/2012)
Q. How many pages will be fetched to Memory?


As many as are needed for the query

Q2. How does server knows that the pages are related to a table?


In short, the allocation pages (or which there are many kinds) and the system tables.

Read Kalen's book, read Paul Randal's blog.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1363925
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse