31.07.2013 Views

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

This would allow us to make a much simpler query:<br />

SELECT uid, location FROM subscribers WHERE uid = 3<br />

Primary Keys and Unique Indexes<br />

You should define a Primary Key for every <strong>MySQL</strong> <strong>Cluster</strong> table. If you don’t, one will be<br />

created automatically, but that’s considered bad practice.<br />

Both the Primary Key and Unique Indexes will use data and index memory, unless you give<br />

the USE HASH option when you create the table. This way, only the hash part will be created<br />

and no data memory will be consumed. Updating data will be faster, less data memory will<br />

be used, but queries doing range scans might be slower.<br />

Historical Data<br />

Remove redundant even quicker within <strong>MySQL</strong>. Only the data that is hot when you have<br />

lots of changes and new records <strong>com</strong>ing.<br />

Disk-Based Tables<br />

Tables can be created so non-indexed fields are going to disk instead of memory. This will<br />

allow you to store much more data in <strong>MySQL</strong> <strong>Cluster</strong>, but you have to also consider some<br />

possible performance penalty.<br />

One of the reasons why <strong>MySQL</strong> <strong>Cluster</strong> is storing in memory is to <strong>com</strong>pensate for the<br />

possible network latency. Hard drives could possibly add more latency.<br />

You will need to create a ‘logfile group’, and ‘tablespaces’. We are not covering this in the<br />

tutorial, but the <strong>MySQL</strong> Manual has a nice example will get you going. Note that you might<br />

need to configure your <strong>MySQL</strong> <strong>Cluster</strong> to get it actually working well.<br />

Some external links:<br />

http://dev.mysql.<strong>com</strong>/doc/refman/5.1/en/mysql-cluster-disk-data.html<br />

http://johanandersson.blogspot.<strong>com</strong>/2008/12/disk-data-summary.html<br />

Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 70/81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!