9

How can I create a FEDERATED on VIEW which placed on remote server? I'm using MySQL.

Konerak
  • 39,272
  • 12
  • 98
  • 118
Tioma
  • 2,120
  • 9
  • 35
  • 52
  • 5
    Why 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 Answers1

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