> For the complete documentation index, see [llms.txt](https://calnix.gitbook.io/aave-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://calnix.gitbook.io/aave-book/on-indexes/why-use-indexes.md).

# Why use indexes?

In a traditional banking setting, interest accruals and corresponding balances can be calculated continuously over any desired period: monthly, daily, hourly. Calculating continuous compounding up to even a per second resolution is trivial as computing power is not expensive.

The same approach cannot be applied on-chain, because computation has to be paid for in gas; and the more complex the computation, the greater the gas fees. Consequently, on-chain lending protocols, such as Aave, use an index to track interest in a gas-efficient manner.&#x20;

1. Gas Efficiency: Gas is a measure of computational effort required to execute transactions or smart contracts on the blockchain. On-chain lending protocols need to handle multiple calculations and updates for each user's lending position. By using an index, the protocol can reduce gas costs by performing calculations based on the index value rather than recalculating interest from scratch for each transaction.
2. Computational Cost: Traditional financial institutions have dedicated systems and infrastructure to handle interest calculations, maintain historical records, and handle complex financial instruments. On-chain lending protocols, operating within the constraints of decentralized networks, need to optimize computational costs. Using an index allows for efficient storage and retrieval of historical interest rates, reducing the computational burden compared to localized storing of interest rates for each transaction.

{% hint style="info" %}
Traditional financial lending, operating within centralized systems, can rely on centralized databases and infrastructure to handle interest calculations without the same constraints.
{% endhint %}


---

# 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:

```
GET https://calnix.gitbook.io/aave-book/on-indexes/why-use-indexes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
