<p>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.</p>

[{'answer_id': 52121, 'author': 'Jason Navarrete', 'author_id': 3920, 'author_profile': 'https://Stackoverflow.com/users/3920', 'pm_score': -1, 'selected': False, 'text': '<pre><code>SELECT ELAPSED_TIME_MIN,SUBSTR(AUTHID,1,10) AS AUTH_ID, \nAGENT_ID, APPL_STATUS,SUBSTR(STMT_TEXT,1,20) AS SQL_TEXT\nFROM SYSIBMADM.LONG_RUNNING_SQL\nWHERE ELAPSED_TIME_MIN &gt; 0\nORDER BY ELAPSED_TIME_MIN DESC\n</code></pre>\n\n<p>Credit: <a href="http://it.toolbox.com/blogs/db2luw/sql-to-view-long-running-queries-13577" rel="nofollow noreferrer">SQL to View Long Running Queries </a></p>\n'}, {'answer_id': 80471, 'author': 'RET', 'author_id': 14750, 'author_profile': 'https://Stackoverflow.com/users/14750', 'pm_score': 1, 'selected': False, 'text': '<p>That\'s because the suggested answer is for DB2, not Informix.</p>\n\n<p>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:</p>\n\n<ul>\n<li><a href="http://docs.rinet.ru/InforSmes/ch22/ch22.htm" rel="nofollow noreferrer">http://docs.rinet.ru/InforSmes/ch22/ch22.htm</a></li>\n<li><a href="http://www.informix.com.ua/articles/sysmast/sysmast.htm" rel="nofollow noreferrer">http://www.informix.com.ua/articles/sysmast/sysmast.htm</a></li>\n</ul>\n'}, {'answer_id': 117079, 'author': 'DL Redden', 'author_id': 20610, 'author_profile': 'https://Stackoverflow.com/users/20610', 'pm_score': 3, 'selected': False, 'text': "<p>If the query is currently running watch the <strong>onstat -g act -r 1</strong> output and look for items with an <strong><em>rstcb</em></strong> that is not 0</p>\n\n<pre><code>Running threads:\n tid     tcb             rstcb            prty status                vp-class      name\n 106     c0000000d4860950 0                2    running               107soc        soctcppoll\n 107     c0000000d4881950 0                2    running               108soc        soctcppoll\n 564457  c0000000d7f28250 c0000000d7afcf20 2    running                 1cpu        CDRD_10\n</code></pre>\n\n<p>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.</p>\n\n<p><strong>c0000000d7afcf20</strong> is the address that we're interested in for this example.</p>\n\n<p>Use <strong>onstat -u | grep c0000000d7afcf20</strong> to find the session</p>\n\n<pre><code>c0000000d7afcf20 Y--P--- 22887    informix -        c0000000d5b0abd0 0    5     14060    3811\n</code></pre>\n\n<p>This gives you the session id which in our example is <strong>22887</strong>. Use <strong>onstat -g ses 22887</strong>\nto 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.</p>\n"}, {'answer_id': 130694, 'author': 'grom', 'author_id': 486, 'author_profile': 'https://Stackoverflow.com/users/486', 'pm_score': 1, 'selected': False, 'text': '<p>Okay it took me a bit to work out how to connect to sysmaster. The JDBC connection string is:</p>\n\n<blockquote>\n  <p>jdbc:informix-sqli://dbserver.local:1526/sysmaster:INFORMIXSERVER=mydatabase</p>\n</blockquote>\n\n<p>Where the port number is the same as when you are connecting to the actual database. That is if your connection string is:</p>\n\n<blockquote>\n  <p>jdbc:informix-sqli://database:1541/crm:INFORMIXSERVER=crmlive</p>\n</blockquote>\n\n<p>Then the sysmaster connection string is:</p>\n\n<blockquote>\n  <p>jdbc:informix-sqli://database:1541/sysmaster:INFORMIXSERVER=crmlive</p>\n</blockquote>\n\n<p>Also found <a href="http://www.informixfaq.com/wiki/doku.php/wiki:sysmaster" rel="nofollow noreferrer">this wiki page</a> that contains a number of SQL queries for operating on the sysmaster tables.</p>\n'}]
['https://Stackoverflow.com/questions/51262', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/486/']