# Cqlsh keeps reporting errors and timeout when querying empty tables

**URL:** <https://forum.scylladb.com/t/cqlsh-keeps-reporting-errors-and-timeout-when-querying-empty-tables/2347>\
**Category:** ScyllaDB\
**Tags:** error-message, troubleshooting\
**Created:** [July 24, 2024, 7:22am UTC](https://forum.scylladb.com/t/cqlsh-keeps-reporting-errors-and-timeout-when-querying-empty-tables/2347 "2024-07-24T07:22:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bo\_li](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/bo_li/32/438_2.png) [@bo\_li](https://forum.scylladb.com/u/bo_li)\
**Post date:** [July 24, 2024, 7:22am UTC](https://forum.scylladb.com/t/cqlsh-keeps-reporting-errors-and-timeout-when-querying-empty-tables/2347/1 "2024-07-24T07:22:58Z")

</div>

I found a very strange phenomenon during the test. Even when I query an empty table, it actually takes a long time. I have already performed a compact on this table.

```bash
]# du -sh /var/lib/scylla/data/alternator_test_5
0 /var/lib/scylla/data/alternator_test_5

]# nodetool flush alternator_test_5
]# nodetool compact alternator_test_5
]# ll
total 0
drwxr-xr-x 2 root root 10 Jul 5 02:32 staging
drwxr-xr-x 2 root root 10 Jul 5 02:32 upload

cqlsh> SELECT * FROM alternator_test_5.test_5 LIMIT 1;
ReadTimeout: Error from server: code=1200 [Coordinator node timed out waiting for replica nodes' responses] message="Operation timed out for alternator_test_5.test_5 - received only 0 responses from 1 CL=ONE." info={'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'}

```

There are other tables with a large number of records in the cluster, but it should not affect the query of empty tables.

---

<div class="post-metadata">

**Author:** ![Guy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/guy/32/9_2.png) [@Guy](https://forum.scylladb.com/u/Guy)\
**Post date:** [July 24, 2024, 9:54am UTC](https://forum.scylladb.com/t/cqlsh-keeps-reporting-errors-and-timeout-when-querying-empty-tables/2347/2 "2024-07-24T09:54:13Z")

</div>

Please provide as many details as possible so people can help you. This includes things like the ScyllaDB version, hardware, OS, and the data model you’re using.

---

<div class="post-metadata">

**Author:** ![Botond\_Denes](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/botond_denes/32/163_2.png) [@Botond\_Denes](https://forum.scylladb.com/u/Botond_Denes)\
**Post date:** [July 24, 2024, 10:25am UTC](https://forum.scylladb.com/t/cqlsh-keeps-reporting-errors-and-timeout-when-querying-empty-tables/2347/3 "2024-07-24T10:25:49Z")

</div>

This is a [known issue](https://github.com/scylladb/scylladb/issues/15752) in ScyllaDB. Scans on sparse (nearly empty) tables often time out.  
The reason for this is in the vnode architecture. Every database cluster has `number_of_nodes * 256` _vnodes_.

When scanning a table, each one of these has to be scanned individually, in ring order, to read the entire content of the table.

With a dense table, that has a lot of data, the query will quickly fill up the page and return to the client, maybe the page will be filled after reading 1-2 _vnodes_ only.

In a sparse table, it may take hundreds or thousands of _vnodes_ to fill a page. In the meanwhile, ScyllaDB will not return to the client, because it wants to fill the page first, so the query will end up timing out.

This can be worked around by increasing the `range_request_timeout_in_ms` in ScyllaDB configuration, and increasing the timeout for these queries on the client side as well.
