在 Informix 上查找长时间运行的查询?
如何找出 Informix 数据库服务器上长时间运行的查询是什么? 我有一个查询正在耗尽 CPU,并且想找出该查询是什么。
How can you find out what are the long running queries are on Informix database server? I have a query that is using up the CPU and want to find out what the query is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果查询当前正在运行,请观察 onstat -g act -r 1 输出并查找 rstcb 不为 0 的
项目例如,第三行是当前正在运行的内容。 如果您有多行具有非零 rstcb 值,则请注意寻找始终或几乎始终存在的行。 这很可能就是您正在寻找的会议。
c0000000d7afcf20 是我们在此示例中感兴趣的地址。
使用 onstat -u | grep c0000000d7afcf20 查找会话
这将为您提供会话 ID,在我们的示例中为 22887。 使用onstat -g ses 22887
列出有关该会话的信息。 在我的示例中,它是一个系统会话,因此 onstat -g ses 输出中看不到任何内容。
If the query is currently running watch the onstat -g act -r 1 output and look for items with an rstcb that is not 0
In this example the third row is what is currently running. If you have multiple rows with non-zero rstcb values then watch for a bit looking for the one that is always or almost always there. That is most likely the session that your looking for.
c0000000d7afcf20 is the address that we're interested in for this example.
Use onstat -u | grep c0000000d7afcf20 to find the session
This gives you the session id which in our example is 22887. Use onstat -g ses 22887
to list info about that session. In my example it's a system session so there's nothing to see in the onstat -g ses output.
好吧,我花了一些时间才弄清楚如何连接到 sysmaster。 JDBC 连接字符串为:
其中端口号与连接到实际数据库时的端口号相同。 也就是说,如果您的连接字符串是:
那么 sysmaster 连接字符串为:
还找到 此 wiki 页面,其中包含许多用于操作 sysmaster 表的 SQL 查询。
Okay it took me a bit to work out how to connect to sysmaster. The JDBC connection string is:
Where the port number is the same as when you are connecting to the actual database. That is if your connection string is:
Then the sysmaster connection string is:
Also found this wiki page that contains a number of SQL queries for operating on the sysmaster tables.
信用:用于查看长时间运行查询的 SQL
Credit: SQL to View Long Running Queries
这是因为建议的答案适用于 DB2,而不是 Informix。
sysmaster 数据库(Informix 共享内存的虚拟关系数据库)可能包含您要查找的信息。 这些页面可能会帮助您入门:
That's because the suggested answer is for DB2, not Informix.
The sysmaster database (a virtual relational database of Informix shared memory) will probably contain the information you seek. These pages might help you get started: