---
title: sql.active_record
description: A SQL query from Rails Active Record. Use request_id to group queries from the same HTTP request.
url: https://docs.honeybadger.io/insights/event-types/ruby/sql.active_record/
---

A SQL query from Rails Active Record. Use request\_id to group queries from the same HTTP request.

Source **Active Record** Category **Database** Fields **9** [honeybadger-ruby](https://docs.honeybadger.io/lib/ruby/)

## Fields

| Field             | Type    | Description                                                                                                  |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| `event_type`      | string  | Allowed value: `sql.active_record`.                                                                          |
| `query`           | string  | The SQL text with bind parameters obfuscated.                                                                |
| `duration`        | number  | Wall-clock time the query took, in milliseconds.                                                             |
| `cached`          | boolean | Whether the query result was served from the ActiveRecord query cache.                                       |
| `async`           | boolean | Whether the query was executed asynchronously.                                                               |
| `request_id`      | string  | Rails request UUID. Shared by all events from the same HTTP request.                                         |
| `instrumenter_id` | string  | Unique identifier for the ActiveSupport::Notifications instrumentation request, assigned by Rails.           |
| `hostname`        | string  | Server hostname. Attached to every event by default (events.attach\_hostname).                               |
| `environment`     | string  | Application environment, e.g. "production". Attached to every event by default (events.attach\_environment). |

## Example

```json
{
  "event_type": "sql.active_record",
  "query": "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = ? LIMIT ?",
  "duration": 2.34,
  "cached": false,
  "async": false,
  "request_id": "0f5e4bb2-3c46-4b1c-91d5-2f4e8a6b9c01",
  "instrumenter_id": "d6a5b3f4c2e1908a7b6c",
  "hostname": "web-1.example.com",
  "environment": "production"
}
```

---

## Try Honeybadger for FREE

Intelligent logging, error tracking, and Just Enough APM™ in one dev-friendly platform. Find and fix problems before users notice.

[Start free trial](https://app.honeybadger.io/users/sign_up)

[See plans and pricing](https://www.honeybadger.io/plans/)
