FEDERATED引擎高级提问,请有环境的同志帮忙测试一下

flairsky 2010-04-30 03:20:34
设想如下:
Master机器利用FEDERATED引擎映射4台分服务器上同类型的表。

在Master机器上用如下语句:
select XXX from FEDERATED_1 where XXX
union all
select XXX from FEDERATED_2 where XXX
union all
select XXX from FEDERATED_3 where XXX
union all
select XXX from FEDERATED_4 where XXX

想要了解的是,上面这句sql是在分服务器_1执行完再到分服务器_2执行,以此类推?还是各台分服务器并发执行相应的select,然后各自返回后union all?

顺道问下FEDERATED引擎稳定性如何?会不会有莫名其妙的状况出现?(我目前没发现,各位有生产环境的经验最好)

...全文
90 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ACMAIN_CHM 2010-04-30
  • 打赏
  • 举报
回复
MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html

When executing queries and statements on a FEDERATED table on the local server, the operations that would normally insert, update or delete information from a local data file are instead sent to the remote server for execution, where they update the data file on the remote server or return matching rows from the remote server.

The basic structure of a FEDERATED table setup is shown in Figure 13.2, “FEDERATED table structure”.

Figure 13.2. FEDERATED table structure


When a client issues an SQL statement that refers to a FEDERATED table, the flow of information between the local server (where the SQL statement is executed) and the remote server (where the data is physically stored) is as follows:

The storage engine looks through each column that the FEDERATED table has and constructs an appropriate SQL statement that refers to the remote table.

The statement is sent to the remote server using the MySQL client API.

The remote server processes the statement and the local server retrieves any result that the statement produces (an affected-rows count or a result set).

If the statement produces a result set, each column is converted to internal storage engine format that the FEDERATED engine expects and can use to display the result to the client that issued the original statement.

flairsky 2010-04-30
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 acmain_chm 的回复:]

各台分服务器并发执行相应的select,然后各自返回后union all
[/Quote]

这样就是最理想状态

这个结论是测试出来的,还是根据理论得出来的?
ACMAIN_CHM 2010-04-30
  • 打赏
  • 举报
回复
各台分服务器并发执行相应的select,然后各自返回后union all
flairsky 2010-04-30
  • 打赏
  • 举报
回复
这个可能牵扯到union all实现机制,有哪位牛人能指点一下?

即,union all 前后的 select 语句是否并发执行?

56,687

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧