How to debug SQL for a transaction to find the code which is triggering itDescription<!-- div.margin{ padding: 10px 40px 40px 30px; } table.tocTable{ border: 1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); padding-top: .6em; padding-bottom: .6em; padding-left: .9em; padding-right: .6em; } table.noteTable{ border:1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); width: 100%; border-spacing:2; } table.internaltable { white-space:nowrap; text-align:left; border-width: 1px; border-collapse: collapse; font-size:14px; width: 85%; } table.internaltable th { border-width: 1px; padding: 5px; border-style: solid; border-color: rgb(245, 245, 245); background-color: rgb(245, 245, 245); } table.internaltable td { border-width: 1px; padding: 5px; border-style: solid; border-color: #E0E0E0; color: #000000; } .title { color: #D1232B; font-weight:normal; font-size:28px; } h1{ color: #D1232B; font-weight:normal; font-size:21px; margin-bottom:-5px } h2{ color: #646464; font-weight:bold; font-size:18px; } h3{ color: #000000; font-weight:BOLD; font-size:16px; text-decoration:underline; } h4{ color: #646464; font-weight:BOLD; font-size:15px; text-decoration:; } h5{ color: #000000; font-weight:BOLD; font-size:13px; text-decoration:; } h6{ color: #000000; font-weight:BOLD; font-size:14px; text-decoration:; } ul{ list-style: disc outside none; margin-left: 0; } li { padding-left: 1em; } --> This will help troubleshooting the exact SQL query which is resulting slow or incorrect, and the code which is calling the incorrect or unexpected SQL. ResolutionIn the Application Navigator select 'Debug SQL (detailed)' and 'Debug Log' (having the log will help you find the SQL for a specific transaction)Open up the Chrome developer tools and switch to the Network tabReproduce the issue and identify the network transaction which is slow or you need to determine what SQL or code it is calling.If the transaction is happening on a page or list load, you should see the SQL output below that page or list.If it is not happening on the page or list load you will need to open a new page to /ui_page.do. (it may be necessary to reproduce the issue and then refresh the ui_page if the information is not there initially.Search for the transaction name from the Network tab to identify the start of the transaction.If you are looking for slowness, find the slow transaction using the time value of the SQL output or look for SQL which is being very repetitive. If you see a lot of repetitive SQL it could be making a bunch of quick queries but in excess which adds up to slowness. To determine the Code which is triggering the SQL click the small + at the end of the SQL statement to expand the Stack track for what triggered the SQL.Normally, you can look for a GlideRecord.query line and then follow the code backward (down the call stack) from that to find the script, business rule, or Java file which is doing the GlideRecord query. Additional InformationThe transaction that is trigging the SQL shown in debug log should also present a similar message when the transaction has ended, with the time it took for that specific line of SQL to run, and the exact SQL query which is being run. You can hover over the ... between SELECT and FROM to see which fields are being queried. This is an example of the Java files to look at to determine what is calling the glideRecord query that eventually runs this SQL: