title: Database Structure & Hard drive seek time confusion
body: <p>could some one help me out trying to understand how hard drive seeking works.</p>
  
  <p>I have a small binary database file which read performance is absolutely essential. If I need to skip a few bytes in the file is it quicker to use seek() or to read() then discard the unwanted data.</p>
  
  <p>If the average seek time of a hard drive is 10ms and the read speed is 300MB/s I calculated that it's quicker to read() than seek() with a value smaller than 3MB. Is true? Is there an overhead when performing a new seek, which reading an existing stream doesn't have?</p>
  
  <p>Which do you think be a more suitable file structure for an index.</p>
  
  <pre><code>Entry1:Value:PointerIntoToData
  Entry2:Value:PointerIntoToData
  Entry3:Value:PointerIntoToData
  Data, Data, Data
  
  Or
  
  Entry1:Value:Data
  Entry2:Value:Data
  Entry3:Value:Data
  </code></pre>
  
  <p>When reading an entry if the value is not correct it will be ignored. So when streaming the file is it quicker to: 
  1. when an entry is not required use seek() to skip over it
  2. when a entry is not needed read it then discard the data
  3. or the use first structure, when an entry is required seek() into a data repository at the end.</p>
  
  <p>Entry is 4 bytes, value is 8 bytes &amp; data is 12KB</p>
  
  <p>Cheers</p>