# HBase Read Merge

the KeyValue cells corresponding to one row can be in multiple places, row cells already persisted are in Hfiles, recently updated cells are in the MemStore, and recently read cells are in the Block cache. So when you read a row, how does the system get the corresponding cells to return? A Read merges Key Values from the block cache, MemStore, and HFiles in the following steps:

1. First, the scanner looks for the Row cells in the Block cache - the read cache. Recently Read Key Values are cached here, and Least Recently Used are evicted when memory is needed.
2. Next, the scanner looks in the MemStore, the write cache in memory containing the most recent writes.
3. If the scanner does not find all of the row cells in the MemStore and Block Cache, then HBase will use the Block Cache indexes and bloom filters to load HFiles into memory, which may contain the target row cells.

![](https://1182370643-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LsbZSe32ZgrQ1gzZoPR%2F-LsbZZk03RhW1ap7TKI8%2F-LsbZ_6xvQ0r0nPXlKzD%2FHBase%20Read%20Merge%201.png?generation=1572621933709862\&alt=media)

there may be many HFiles per MemStore, which means for a read, multiple files may have to be examined, which can affect the performance. This is called read amplification.

![](https://1182370643-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LsbZSe32ZgrQ1gzZoPR%2F-LsbZZk03RhW1ap7TKI8%2F-LsbZ_6zAfihb4CNXbYG%2FHBase%20Read%20Merge.png?generation=1572621933773131\&alt=media)


---

# Agent Instructions: 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://nag-9-s.gitbook.io/hbase/hbase-architecture/hbase-read-merge.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.
