Rechercher dans le manuel MySQL
16.8.3 FEDERATED Storage Engine Notes and Tips
You should be aware of the following points when using the
FEDERATED
storage engine:
FEDERATED
tables may be replicated to other slaves, but you must ensure that the slave servers are able to use the user/password combination that is defined in theCONNECTION
string (or the row in themysql.servers
table) to connect to the remote server.
The following items indicate features that the
FEDERATED
storage engine does and does not
support:
The remote server must be a MySQL server.
The remote table that a
FEDERATED
table points to must exist before you try to access the table through theFEDERATED
table.It is possible for one
FEDERATED
table to point to another, but you must be careful not to create a loop.A
FEDERATED
table does not support indexes in the usual sense; because access to the table data is handled remotely, it is actually the remote table that makes use of indexes. This means that, for a query that cannot use any indexes and so requires a full table scan, the server fetches all rows from the remote table and filters them locally. This occurs regardless of anyWHERE
orLIMIT
used with thisSELECT
statement; these clauses are applied locally to the returned rows.Queries that fail to use indexes can thus cause poor performance and network overload. In addition, since returned rows must be stored in memory, such a query can also lead to the local server swapping, or even hanging.
Care should be taken when creating a
FEDERATED
table since the index definition from an equivalentMyISAM
or other table may not be supported. For example, creating aFEDERATED
table with an index prefix onVARCHAR
,TEXT
orBLOB
columns will fail. The following definition inMyISAM
is valid:The key prefix in this example is incompatible with the
FEDERATED
engine, and the equivalent statement will fail:If possible, you should try to separate the column and index definition when creating tables on both the remote server and the local server to avoid these index issues.
Internally, the implementation uses
SELECT
,INSERT
,UPDATE
, andDELETE
, but notHANDLER
.The
FEDERATED
storage engine supportsSELECT
,INSERT
,UPDATE
,DELETE
,TRUNCATE TABLE
, and indexes. It does not supportALTER TABLE
, or any Data Definition Language statements that directly affect the structure of the table, other thanDROP TABLE
. The current implementation does not use prepared statements.FEDERATED
acceptsINSERT ... ON DUPLICATE KEY UPDATE
statements, but if a duplicate-key violation occurs, the statement fails with an error.Transactions are not supported.
FEDERATED
performs bulk-insert handling such that multiple rows are sent to the remote table in a batch, which improves performance. Also, if the remote table is transactional, it enables the remote storage engine to perform statement rollback properly should an error occur. This capability has the following limitations:The size of the insert cannot exceed the maximum packet size between servers. If the insert exceeds this size, it is broken into multiple packets and the rollback problem can occur.
Bulk-insert handling does not occur for
INSERT ... ON DUPLICATE KEY UPDATE
.
There is no way for the
FEDERATED
engine to know if the remote table has changed. The reason for this is that this table must work like a data file that would never be written to by anything other than the database system. The integrity of the data in the local table could be breached if there was any change to the remote database.When using a
CONNECTION
string, you cannot use an '@' character in the password. You can get round this limitation by using theCREATE SERVER
statement to create a server connection.The
insert_id
andtimestamp
options are not propagated to the data provider.Any
DROP TABLE
statement issued against aFEDERATED
table drops only the local table, not the remote table.FEDERATED
tables do not work with the query cache.User-defined partitioning is not supported for
FEDERATED
tables.
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-federated-usagenotes.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.