Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One of the possible ways to implement this behavior is by using a table with the <em>FEDERATED</em> storage engine (as opposed to MyISAM, InnoDB, ..).</p> <p>This storage is essentially a proxy. Say you have a table '<em>remote_table</em>' on database '<em>remote_db</em>' on host '<em>remote_host</em>'. If you want to use that table as if it was a local table on database '<em>local_db</em>' on host '<em>local_host</em>', you'd set up a new table '<em>local_table</em>' on '<em>local_db</em>' with the <em>FEDERATED</em> storange engine, and point it to '<em>remote_table</em>' on '<em>remote_host.remote_db</em>'. It will act as a virtual, proxying table, forwarding statements through the MySQL client API to the remote table and returning results.</p> <p>Setting up and using <em>FEDERATED</em> tables in ludicrously easy.</p> <p>On the remote_db, you don't need to do anything special, except maybe create a dedicated user for this table, for security reasons, with limited privileges.</p> <p>On the local_db, you create a new table that mirrors the remote_table:</p> <pre><code>CREATE TABLE federated_table ( [column definitions go here] ) ENGINE=FEDERATED CONNECTION='mysql://remote_user@remote_host:9306/remote_db/remote_table'; </code></pre> <p>Those last 2 lines do all the magic - they make this table act as a proxy for a remote table, specified in the <code>CONNECTION</code> line.</p> <p>There are some gotcha's, though - no transactions, no query cache (on the local_host server), slower performance on huge batch inserts, ...</p> <p>References: <a href="http://dev.mysql.com/doc/refman/5.6/en/federated-storage-engine.html" rel="nofollow">The MySQL documentation</a></p>
    singulars
    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. 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