title: Performance of MySql Xml functions?
body: <p>I am pretty excited about the new <a href="http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html#function_updatexml" rel="noreferrer">Mysql XMl Functions</a>.</p>
  
  <p>Now I can finally embed something like "object oriented" documents in my oldschool relational database.</p>
  
  <p>For an example use-case consider a user who sings up at your website using facebook connect. 
  You can fetch an object for the user using the graph api, and get nice information. This information however can vary vastly. Some fields may or may not be set, some may be added over time and so on.</p>
  
  <p>Well if you are just intersted in very special fields (for example friends relations, gender, movies...), you can project them into your relational database scheme. </p>
  
  <p>However using the XMl functions you could store the whole object inside a field and then your different models can access the data using the <a href="http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html#function_extractvalue" rel="noreferrer">ExtractValue</a> function. You can store everything right away without needing to worry what you will need later.</p>
  
  <p>But what will the performance be?</p>
  
  <p>For example I have a table with 50 000 entries which represent useres.
  I have an enum field that states <code>"male", "female</code>" (or various other genders to be politically correct).</p>
  
  <p>The performance of for example fetching all males will be very fast.</p>
  
  <ul>
  <li><p>But what about something like <code>WHERE ExtractValue(userdata, '/gender/') = 'male'</code> ?</p></li>
  <li><p>How will the performance vary if the object gets bigger?</p></li>
  <li><p>Can I maby somehow put an Index on specified xpath selections?</p></li>
  <li><p>How do field types work together with this functions/performance. Varchar/blob?</p></li>
  <li><p>Do I need fulltext indexes?</p></li>
  </ul>
  
  <p>To sum up my question:</p>
  
  <p>Mysql XML functins look great. And I am sure they are really great if you just want to store structured data that you fetch and analyze further in your application.</p>
  
  <p>But how will they stand battle in procedures where there are internal scans/sorting/comparision/calculations performed on them?</p>
  
  <p>Can Mysql replace document oriented databases like CouchDB/Sesame?</p>
  
  <p>What are the gains and trade offs of XML functions?</p>
  
  <p>How and why are they better/worse than a dynamic application that stores various data as attributes?</p>
  
  <p>For example a key/value table with an xpath as key and the value as value connected to the document entity.</p>
  
  <p>Anyone made any other experiences with it or has noticed something mentionable?</p>