---
title: ecto.query
description: An Ecto repository ran a database query. The event_type comes from the repo telemetry_prefix, so [:my_app, :repo, :query] becomes "my_app.repo.query". Honeybadger skips transaction bookkeeping, schema migrations, and Oban job table queries by default.
url: https://docs.honeybadger.io/insights/event-types/elixir/ecto.query/
---

An Ecto repository ran a database query. The event\_type comes from the repo telemetry\_prefix, so \[:my\_app, :repo, :query] becomes “my\_app.repo.query”. Honeybadger skips transaction bookkeeping, schema migrations, and Oban job table queries by default.

Source **Ecto** Category **Database** Fields **11** [honeybadger-elixir](https://docs.honeybadger.io/lib/elixir/)

## Fields

| Field         | Type                   | Description                                                                                                       |
| ------------- | ---------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `event_type`  | string                 |                                                                                                                   |
| `query`       | string                 | Obfuscated SQL with bind parameters replaced by ?.                                                                |
| `source`      | string                 | Table/source name the query targets.                                                                              |
| `query_time`  | number                 | Time spent executing the query in microseconds.                                                                   |
| `decode_time` | number                 | Time spent decoding the result in microseconds.                                                                   |
| `queue_time`  | number                 | Time spent waiting for a database connection in microseconds.                                                     |
| `total_time`  | number                 | Total time including queue, query, and decode in microseconds.                                                    |
| `stacktrace`  | array\<array\<string>> | Formatted call stack at query time. Present when include\_stacktrace is true and the repo has stacktrace enabled. |
| `params`      | array\<any>            | Query parameters. Present when include\_params is true.                                                           |
| `request_id`  | string                 | Request ID from the current EventContext.                                                                         |
| `idle_time`   | number                 | Time the connection spent idle before the query in microseconds.                                                  |

## Example

```json
{
  "event_type": "my_app.repo.query",
  "query": "SELECT u0.\"id\", u0.\"email\", u0.\"name\" FROM \"users\" AS u0 WHERE (u0.\"id\" = $?)",
  "source": "users",
  "query_time": 3200,
  "decode_time": 180,
  "queue_time": 45,
  "total_time": 3425,
  "stacktrace": [
    [
      "lib/my_app/accounts.ex:27",
      "MyApp.Accounts.get_user!/1"
    ],
    [
      "lib/my_app_web/controllers/user_controller.ex:14",
      "MyAppWeb.UserController.show/2"
    ]
  ],
  "params": [
    42
  ],
  "request_id": "F8ZBOg1zcBQDqDgAAADx",
  "idle_time": 120000
}
```

---

## 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/)
