Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've been testing this myself, and I've come up with pretty consistent results. <em>(Even though my tests are a tad crude.)</em></p> <p>I've tested three computers </p> <ol> <li>Windows 7 (x64), PHP 5.3, MySQL 5.1 </li> <li>Ubuntu 9.10 (x64) PHP 5.2, MySQL 5.1</li> <li>Ubuntu 10.04 (x32) PHP 5.3, MySQL 5.1</li> </ol> <p>So far the tests on all three platforms have indicated the same tings:</p> <ul> <li>Inserting into a BLOB is 2x to 8x faster on MyISAM than on InnoDB. The difference seems to be higher on binary strings than HEX-coded strings. <em>(See the data below)</em></li> <li>Using a HEX coded string <em>(<code>bin2hex</code> into a <code>X'...'</code>)</em> uses more memory, on average, than using an escaped binary string <em>(<code>mysql_real_escape_string</code> on the raw data)</em>. - This seems true for both MyISAM and InnoDB.</li> <li>The binary string is faster on MyISAM, but the HEX-coded data is faster on InnoDB.</li> </ul> <hr> <p>The test was basically just a simple loop that escaped or hex-coded the raw data <em>(a 2.4 MiB image retrieved once at the top of the script)</em>, constructed the query string, and executed it via the <code>mysql_query</code> or <code>mysqli::query</code> functions. - I tested with both extensions. Didn't seem to be any difference.</p> <p>I put the results from the Ubuntu 10.04 (#3) up in spreadsheets. The results from the Ubuntu 9.10 (#2) machine were pretty much the same, so I didn't bother set them up:<br> <em>(Finally an excuse to test the Google Docs thing properly! xD)</em></p> <ul> <li><a href="http://spreadsheets.google.com/ccc?key=0AsQ8-jk24zuwdHN5YkVaMUtZaHdJRGxGWW1uNVBPVVE&amp;hl=en" rel="noreferrer">Binary string on MyISAM</a></li> <li><a href="http://spreadsheets.google.com/ccc?key=0AsQ8-jk24zuwdGplbWtFYUprZzk0Rjh1elVtQjA4b2c&amp;hl=en" rel="noreferrer">HEX-coded string on MyISAM</a></li> <li><a href="http://spreadsheets.google.com/ccc?key=0AsQ8-jk24zuwdE1ja1llOThyNER0MVBIamNUMTEzREE&amp;hl=en" rel="noreferrer">Binary string on InnoDB</a></li> <li><a href="http://spreadsheets.google.com/ccc?key=0AsQ8-jk24zuwdDNTd25ZVDlfd2xsdVpVc1ZNMWZEUEE&amp;hl=en" rel="noreferrer">Hex-coded string on InnoDB</a></li> </ul> <p>These graphs show the private memory usage by the <code>mysqld</code> process on the Win7 (#1) machine.</p> <ul> <li><a href="http://atli.advefir.com/images/hexbin1/myisam_bin_1.gif" rel="noreferrer">Binary string on MyISAM</a></li> <li><a href="http://atli.advefir.com/images/hexbin1/myisam_hex_1.gif" rel="noreferrer">HEX-coded string on MyISAM</a></li> <li><a href="http://atli.advefir.com/images/hexbin1/innodb_bin_1.gif" rel="noreferrer">Binary string on InnoDB</a></li> <li><a href="http://atli.advefir.com/images/hexbin1/innodb_hex_1.gif" rel="noreferrer">HEX-coded string on InnoDB</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload