How can I create a FEDERATED on VIEW which placed on remote server? I'm using MySQL.
Asked
Active
Viewed 1.0k times
9
-
5Why don't you just try? `CREATE TABLE federated_table(...) ENGINE=FEDERATED CONNECTION='mysql://user@host:port/db/view';` If it works, it works... ;-) There is no official documentation available, so testing would be the fastest way to answer your question. – Stefan Gehrig Mar 23 '11 at 10:50
-
Documentation doesn't say that FEDERATED has views limitation, and thumbs up @stefan for suggesting that you try it yourself :) – Furicane Mar 23 '11 at 10:53
-
Agree. FEDERATED it is an engine. Only in tables it can be defined. – Devart Mar 23 '11 at 10:53
-
Ah, thanks. for some reason thought it is wrong because for CREATE VIEW have not CONNECTION in mysql doc. Thanks on more! – Tioma Mar 23 '11 at 15:19
1 Answers
21
Yes, you can create a FEDERATED table on a VIEW.
Here's a simple example:
create table t_table (
id int not null auto_increment primary key
) engine = innodb;
create or replace view v_view as select * from t_table;
create table f_fed_table (
id int not null
) ENGINE=FEDERATED CONNECTION='mysql://user:password@127.0.0.1:3306/test/v_view';

Ike Walker
- 64,401
- 14
- 110
- 109