title: Update MySQL database from XML file
body: <p>I got 2 tables in mySQL database: </p>
  
  <p>Persons:</p>
  
  <pre><code>id    name     address .....
  </code></pre>
  
  <p>and Items:</p>
  
  <pre><code>id   person_id  param1  param2 ....
  </code></pre>
  
  <p>items are referenced by person_id to Persons. There is about 5000 persons and 40,000 items and growing. This data need to be updated every few days from big XML file what look like this:</p>
  
  <pre><code>.....
  &lt;person id='100016' lastname='....' firstname='.....' ....  &gt;
  &lt;item param1='...' startdate='2006-01-07' enddate='2006-12-09' ... /&gt;
  &lt;item param1='...' startdate='2007-01-04' enddate='2007-12-08' ... /&gt;
  &lt;item param1='...' startdate='2008-01-04' enddate='2009-01-03' ... /&gt;
  &lt;item param1='...' startdate='2009-01-06' enddate='2009-12-31' ... /&gt;
  &lt;/person&gt;
  ......
  </code></pre>
  
  <p>Some attributes of person and item can change, new persons, and new items could be added.</p>
  
  <p><strong>What is best way to keep it easy to update ?</strong> I do not think that truncating tables and loading them again would most effective way. Should I consider some staging - size of XML file start to have meaning 60MB and growing -> it not effective to have it parsed to SimpleXML and comparing with SQL...</p>
  
  <p><strong>What would be a best practice in situation like this ?</strong></p>
  
  <p>I have mySQL and PHP with Zend Framework as my environment</p>