> For the complete documentation index, see [llms.txt](https://docs.telys.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.telys.ai/working-with-data/inspect-stats.md).

# Inspect stats

`stats()` returns one dictionary describing a collection: the runtime statistics — row counts, index state, partitions — plus the collection's `name`, its partition-key column `key_name`, and its `external_ids`. Use it to read the size and shape of a collection without reading any records.

{% hint style="info" %}
`stats()` reports live state only; it does not read payloads. It works whether the collection uses exact or [IVF](/working-with-data/build-ivf-index.md) search.
{% endhint %}

## Read the stats

```python
from telys import Telys

telys = Telys("./telys-data")
col = telys.open_collection("notes")   # no embedder needed to read stats

s = col.stats()

print("name       :", s["name"])
print("key column :", s["key_name"])
print("external   :", s["external_ids"])
print("full stats :", s)
```

## What the dictionary contains

| Key            | Always present   | What it tells you                                                               |
| -------------- | ---------------- | ------------------------------------------------------------------------------- |
| `name`         | yes              | The collection name.                                                            |
| `key_name`     | yes              | The physical partition-key column (from `partition_by`).                        |
| `external_ids` | yes              | The live external IDs — mirrors `len(col)`.                                     |
| runtime stats  | runtime-provided | Row counts, index state (exact / IVF), partition breakdown, and probe settings. |

`key_name` is the **single** physical partition key. A list or tuple passed to `partition_by` uses only its first element — Telys builds no composite keys, so compose one string with `scope_key(...)` if you need several parts. See [Partitions & scope keys](/understand-telys/partitions-scope-key.md).

{% hint style="warning" %}
The runtime-statistics keys come from the runtime and may vary by version. Read `name`, `key_name`, and `external_ids` by name; treat the rest as informational and do not hard-code assumptions about it.
{% endhint %}

## Expected result

For a saved collection of 1,240 rows partitioned by `scope`, still on exact search:

```
name       : notes
key column : scope
external   : 1240
full stats : {'name': 'notes', 'key_name': 'scope', 'external_ids': 1240, 'rows': 1240, 'index': 'exact', 'partitions': 12}
```

`external_ids` always agrees with `len(col)`. If `index` reports `exact` on a large collection, that is your cue to [build an IVF index](/working-with-data/build-ivf-index.md) or run a tuning pass.

{% hint style="info" %}
`stats()` is also available over a [RemoteTelys](/reference/remote-api.md) connection — `RemoteCollection` includes it, so you can inspect a served collection the same way.
{% endhint %}

## Next steps

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Interpret tuning results</strong></td><td>Turn stats and a tuning plan into decisions.</td><td><a href="/pages/dVG4mjMMPwA41mVMfhqv">/pages/dVG4mjMMPwA41mVMfhqv</a></td></tr><tr><td><strong>Build the IVF index</strong></td><td>Act on an exact index that has grown large.</td><td><a href="/pages/vAtnT9NtTA0el7skR3vX">/pages/vAtnT9NtTA0el7skR3vX</a></td></tr><tr><td><strong>Tuning &#x26; tradeoffs</strong></td><td>How recall, speed, and memory trade off.</td><td><a href="/pages/tVrk8vG4vvlGOMGKSaut">/pages/tVrk8vG4vvlGOMGKSaut</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.telys.ai/working-with-data/inspect-stats.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
