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

Ruby Agent SQL Obfuscation



Please paste the permalink to the page in question below:

Please share your agent version and other relevant versions below:

newrelic_rpm (

Please share your question/describe your issue below. Include any screenshots that may help us understand your question:

Most ActiveRecord SQL Queries have obfuscated table names. According to the documentation table names should not be obfuscate.

Could you please help me understand how the sql string is obfuscated and possible scenarios in which table names are also obfuscated? I can see some database queries which are not obfuscated (selecting from pg_attributes) - while everything else from the application is fully obfuscated:

Total Duration    Query
214 ms            SELECT ?.* FROM ? WHERE ?.? = $? LIMIT ?

We’d like to avoid using the raw configuration, unless there is no other way.


hey @vincent.desmet

I see you have a ticket open so i’m going to work through that with you and come back here to share what’s happened for others to see!



What was the conclusion here? I have multiple apps configured the same on new relic and 1 of the many shows “SELECT ?.* FROM ? WHERE ?.? = $? LIMIT $?” in the sql traces.


Hey @shaun6,

It could be that the slow_sql.record_sql setting in your New Relic configuration file is set to obfuscated. You could try changing that value to raw. However, if you are using an ORM such as ActiveRecord, configuring record_sql: raw may result in you not seeing the raw query.

This is because our ActiveRecord instrumentation is based off of ActiveSupport::Notifications. When record_sql is set to raw, the agent will record the value stored under the :sql key in the ActiveSupport notification payload (seen here).

So if you’re seeing queries with parameterised values in the query (i.e. $1 , ? ) despite record_sql: raw being configured, the agent is just reporting what it’s getting from the ActiveSupport::Notifications payload.

Hope that helps. Let us know how it goes!


setting to raw worked, thanks!


Great to hear @shaun6 ! :smiley: