Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Is there a way to see the sql logs that get run on a site?


I know there is a top level view of the sql calls that get made but can I see a log of all the sql calls that get made somewhere?

Trying to track down where and when a delete call is happening.

Thanks in advance.


Hi Jonathan,

Unfortuantely, we don’t focus on the individual transactions that comprise normal behavior - just the outliers (slow/erroring), so we won’t be able to help you find that call - unless it is slow or erroring already.

However, depending on your database skills, there are some ways you can perhaps make it slow. Specifically, if you create a trigger on delete on the specified table to cause a delay (eg for mysql: ‘SLEEP(2)’), then all the deletes will be “slow sql” and we’ll record them, along with stack traces of where they happened and what transaction they happened during.

Clearly this is not optimal or long-term viable, but put in place for a little while and if the scope of what you are looking for is small enough (eg: not all deletes, but deletes that match a specific pattern), you could be successful in pinpointing the culprit.

Note to future readers: This is not a best practice! But in conjunction with our APM agents, it can be a successful quick/dirty debugging technique.