dsz90288 2013-05-16 22:37
浏览 112

聚合PHP中多个mySQL数据库的结果

I have a large # (say 100) of databases with identical schemas and want to do SQL aggregates across this entire collection of databases.

Lets say the table is ATHLETES

CREATE TABLE ATHLETES(JERSEYNUM, FIRSTNAME, LASTNAME, TEAMNAME, SPORT)

I want to be able to dynamically specify a query like

SELECT SPORT, COUNT(*) FROM ATHLETES GROUP BY SPORT

And have it run across all 100 of my databases, producing one combined result set.

The important thing is I want to do this dynamically -- I want to type a SQL query into a PHP-based web UI and execute it.

Also these queries are typically slow (3 min each), so I'd rather they run in parallel then in serial and take 300 mins.

  • 写回答

1条回答

  • dsm0688 2013-05-16 22:47
    关注

    In my opinion, you should create a table with the databases login data and then loop through all the db's with your query and collect the data in php arrays. As far as I know is possible to join tables but not join db's? I don't think it will be possible to run parallel queries.

    评论

报告相同问题?

悬赏问题

  • ¥15 kali环境运行volatility分析android内存文件,缺profile
  • ¥15 写uniapp时遇到的问题
  • ¥15 vs 2008 安装遇到问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线