{
  "schema_version": 2,
  "id": "commands/latency-history",
  "title": "LATENCY HISTORY",
  "url": "https://redis.io/docs/latest/commands/latency-history/",
  "summary": "Returns timestamp-latency samples for an event.",
  "since": "2.8.13",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:09+01:00",
  "page_type": "content",
  "content_hash": "fc07fdffd5c38c8005daa673855bb00053c0044b007ff9746232b91213fd594d",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "The `LATENCY HISTORY` command returns the raw data of the `event`'s latency spikes time series.\n\nThis is useful to an application that wants to fetch raw data in order to perform monitoring, display graphs, and so forth.\n\nThe command will return up to 160 timestamp-latency pairs for the `event`.\n\nValid values for `event` are:\n* `active-defrag-cycle`\n* `aof-fsync-always`\n* `aof-stat`\n* `aof-rewrite-diff-write`\n* `aof-rename`\n* `aof-write`\n* `aof-write-active-child`\n* `aof-write-alone`\n* `aof-write-pending-fsync`\n* `command`\n* `expire-cycle`\n* `eviction-cycle`\n* `eviction-del`\n* `fast-command`\n* `fork`\n* `rdb-unlink-temp-file`"
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>event</code></summary>\n\nThe latency event to return the history for.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]\n\nFor more information refer to the [Latency Monitoring Framework page](https://redis.io/docs/latest/operate/oss_and_stack/management/optimization/latency-monitor)."
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> | <span title=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays): an array where each element is a two elements array representing the timestamp and the latency of the event.\n\n**RESP3:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays): an array where each element is a two elements array representing the timestamp and the latency of the event."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "127.0.0.1:6379> latency history command\n1) 1) (integer) 1405067822\n   2) (integer) 251\n2) 1) (integer) 1405067941\n   2) (integer) 1001",
      "section_id": "examples"
    }
  ]
}
