通过 ajax 开始并监控长时间运行的 SQL 查询的进度
是否可以启动一个需要大量时间的查询并通过 Ajax 从 UI 监视进度?
我考虑将该过程作为“运行一次”作业启动,计划立即运行。我可以将结果存储在临时表中,以便在完成后快速检索。我还可以记录报告的运行时间并求出平均值,以估计进度条的运行时间。
我目前使用 Microsoft SQL 2005,但如果有必要,我愿意使用其他 DBMS,例如 SQL 2008、MySQL 等。
Is it possible to start a query that will take a significant amount of time and monitor progress from the UI via Ajax?
I considered starting the process as a "run once" job that is scheduled to run immediately. I could store the results in a temporary table for quick retrieval once it's complete. I could also log the run time of the report and average that out, to guestimate the running time for the progress bar.
I use Microsoft SQL 2005 at the moment, but I'm willing to other DBMS such as SQL 2008, MySQL, etc if necessary.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个想法是,如果长时间运行的作业填充另一个表。
您有第二个数据库连接来监视源行中处理了多少行,并每隔几秒显示一个简单的“已处理 x 行”
如果您也有一个源表:
..那么您可以使用“x of y rows”基本上
,您必须使用第二个连接来监视第一个连接。然而,你还需要一些东西来衡量......
One idea, if the long running job populates another table.
You have a 2nd database connection to monitor how many rows are processed out of the source rows, and show a simple "x rows processed" every few second
If you have a source table too:
..then you can use "x of y rows processed"
Basically, you have to use a 2nd connection to monitor the first. However, you also need something to measure...