大型分析数据库响应式检索 (MYSQL)

发布于 2024-08-13 23:31:45 字数 217 浏览 4 评论 0原文

我想为网络创建一个“谷歌分析”类型的应用程序 - 即一个基于网络的工具来为我的数据库做一些报告和图表。问题是数据库很大,所以我无法实时执行查询,因为它们会花费太长时间并且该工具将无响应。

我如何使用 cron 作业来帮助我?使我的图表具有响应能力的最佳方法是什么?我想我需要对一些数据库表进行非形式化,但是如何使这些查询更快呢?我可以将哪些中间值存储在另一个数据库表中以使其更快?

谢谢!

I want to create a 'google analytics' type application for the web - i.e. a web-based tool to do some reporting and graphing for my database. The problem is that the database is HUGE, so I can't do the queries in real time because they will take too long and the tool will be unresponsive.

How can I use a cron job to help me? What is the best way to be able to make my graphs responsive? I think I will need to denomalize some of my database tables, but how do I make these queries faster? What intermediate values can I store in another database table to make it quicker?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

作业与我同在 2024-08-20 23:31:45

商业智能 (BI) 是一门相当成熟的学科 - 您可以在任何有关扩展数据库以进行报告和统计的书籍中找到问题的答案。数据仓库。

高级策略列表包括:

  • 分区(因为索引对大多数报告没有什么帮助)
  • 汇总表(通常通过 cron 提交的批处理过程生成)
  • 你需要一个好的优化器(一些数据库,如 mysql 不需要 - 所以让糟糕的连接决策)
  • 查询并行性(某些数据库只需将查询拆分为多个线程即可提供线性加速)
  • 星型模式 - 良好的数据模型对于良好的性能至关重要

一般情况下,动态报告会让人大吃一惊静态报告 - 因此,如果您需要强大的报告,我只是尝试将数据复制到适当的模型中,使用聚合,可能会更改数据库以获得良好的优化器和适当的功能,而不是批量运行报告。

Business Intelligence (BI) is a pretty mature discipline - and you'll find answers to your questions in any book on scaling databases for reporting & data warehousing.

A high-level list of tactics would include:

  • partitioning (because indexes are little help for most reporting)
  • summary tables (generated usually through a batch process submit via cron)
  • you need a good optimizer (some databases like mysql don't - so make poor joining decisions)
  • query parallelism (some databases will provide linear speedups just by splitting your query into multiple threads)
  • star-schema - a good data model is crucial to good performance

In general dynamic reporting beats the pants off static reporting - so if you're after powerful reporting I'd just try to copy data into an appropriate model, use aggregates, possibly change the database to get a good optimizer and the appropriate features rather than run reports in batch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文