# How do I use \`query()\` safely?

**URL:** https://forum.scylladb.com/t/how-do-i-use-query-safely/1254
**Category:** ScyllaDB
**Tags:** open-source, troubleshooting, rust-driver
**Created:** [January 30, 2024, 4:50pm UTC](https://forum.scylladb.com/t/how-do-i-use-query-safely/1254 "2024-01-30T16:50:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![james-kay](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/james-kay/32/629_2.png) [@james-kay](https://forum.scylladb.com/u/james-kay)
#### Post date: [January 30, 2024, 4:50pm UTC](https://forum.scylladb.com/t/how-do-i-use-query-safely/1254/1 "2024-01-30T16:50:25Z")

</div>

In a Rust codebase I work with, we use `scylladb::Session::query()` to retrieve some fixed-size results. However, sometimes we get the error:

```auto
Tombstones processed by unpaged query exceeds limit of 10000
(configured via query_tombstone_page_limit)

```

I’ve investigated this error and it seems that:

- `query_tombstone_page_limit` is a parameter that tells ScyllaDB how many tombstones to process before cutting a new page of results in paged queries — presumably to limit the computational complexity of evaluating each page;
- When the query is _unpaged_, processing more than `query_tombstone_page_limit` tombstones in the course of the query causes the query to error out.

As a caller of the API, I can’t know statically how many tombstones my query will traverse. Does this mean that the only way to avoid triggering this error is to always use paged queries? If that’s true, I don’t see what the use case for unpaged queries is — doesn’t this imply that the user must always use paged queries, regardless of the size of their results?

---

<div class="post-metadata">

### Author: ![Marcin\_Maliszkiewicz](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/marcin_maliszkiewicz/32/37_2.png) [@Marcin\_Maliszkiewicz](https://forum.scylladb.com/u/Marcin_Maliszkiewicz)
#### Post date: [February 1, 2024, 10:39am UTC](https://forum.scylladb.com/t/how-do-i-use-query-safely/1254/2 "2024-02-01T10:39:59Z")

</div>

Hello, you can check this article on how to reduce number of tombstones: [How to flush old tombstones from a table | ScyllaDB Docs](https://opensource.docs.scylladb.com/stable/kb/tombstones-flush.html).

You can statistically assess how many tombstones there are based on your write load and compaction rate.
