title: How Database Query Data Processed Between 3 Computers?
body: <p>I'm trying to understand how data is really processed and sent between servers, but am unable to find a step by step detailed explanation. To explain using an example:</p>
  
  <p>Assume you have 100M records that's 10GB in size and you need to transfter the data between 2 database servers over a LAN using a separate desktop computer to execute the script. In total you have three computers: </p>
  
  <ol>
  <li>Server A has the source database you are selecting the data from.</li>
  <li>Server B has the destination database you are writing the data to.</li>
  <li>Desktop C is where you are executing your script from, using a client tool like SQL Developer or TOAD.</li>
  </ol>
  
  <p>The SQL would look something like this:</p>
  
  <pre><code>Insert Into ServerBDatabase.MyTable (MyFields) 
  Select MyFields 
  From ServerADatabase.MyTable
  </code></pre>
  
  <p>Can someone explain where the data is processed and how it is sent? Or even point me to a good resource to read up on the subject.</p>
  
  <p>For example, I'm trying to understand if it's something like this:</p>
  
  <ol>
  <li><p>The client tool on Desktop C sends the query command to the DBMS on Server A. At this point, all that is being sent over the LAN is the text of the command.</p></li>
  <li><p>The DBMS on Server A receives the query command, interprets it, and then 
  processes the data on Server A. At this point, the full 10GB data is loaded into memory for processing and nothing is being sent over the LAN.</p></li>
  <li><p>Once the full 100M records are done being processed on Server A, the DBMS on Server A sends both the text of the query command and the full 100M records of data over the LAN to the DBMS on Server B. Given bandwidth constraints, this data is broken up and sent in chunks over the LAN at some amount of bits per second and loaded on Server B's memory in those data chunk amounts.</p></li>
  <li><p>As the DBMS on Server B recieves the chunks of data over the LAN, it then pieces it back together on Server B in it's memory to retun it back to it's full 100M records state.</p></li>
  <li><p>Once the 100M records are fully pieced back together by the DBMS on Server B, the DBMS on Server B then executes the query command to insert the records from it's memory in the destination table one row at a time and writes it to disk.</p></li>
  </ol>
  
  <p>All of this are assumptions, so I know I could have it all wrong which is why I'm seeking help. Please help correct my errors and/or fill in the blanks.</p>