# High Performance PostgreSQL for Rails: users count inconsistency (page 56)

**URL:** <https://forum.devtalk.com/t/high-performance-postgresql-for-rails-users-count-inconsistency-page-56/143431>\
**Category:** PragProg Customers\
**Tags:** book-high-performance-postgresql-for-rails, errata\
**Created:** [12 February 2024 01:58 UTC](https://forum.devtalk.com/t/high-performance-postgresql-for-rails-users-count-inconsistency-page-56/143431 "2024-02-12T01:58:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![andatki](https://forum.devtalk.com/user_avatar/forum.devtalk.com/andatki/32/5332_2.png) [@andatki](https://forum.devtalk.com/u/andatki)\
**Post date:** [12 February 2024 17:26 UTC](https://forum.devtalk.com/t/high-performance-postgresql-for-rails-users-count-inconsistency-page-56/143431/2 "2024-02-12T17:26:28Z")

</div>

Hi @BraisonCrece. Thanks for posting this. The `statement_timeout` is used to set the max allowed time for operations to run before they’re cancelled.

What we need to do there is raise the `statement_timeout` to allow for more time. We can do that in several ways: by modifying the user’s persistent value, by modifying it within a psql session, or modifying it only for the scope of a single transaction. If you used the Rideshare scripts to create the owner or app\_user users, you could modify them with a statement like this one:

```sql
ALTER ROLE owner SET statement_timeout = '60s';

```

That would raise the statement timeout to 60 seconds on an ongoing basis. You may need to raise it even more. You can also set it back later if you’d like.

You can also raise the statement timeout within a session:

```sql
SET statement_timeout = '60s';

```

Or you can scope the change to an individual transaction using the `LOCAL` keyword. To do that, use `SET LOCAL` as follows:

```sql
SET LOCAL statement_timeout = '60s';

```

With the bigger row count table where operations are taking longer, try raising the statement timeout and performing the operation, and letting me know if that fixes it for you.

Thanks!

---

_[View the full topic](https://forum.devtalk.com/t/high-performance-postgresql-for-rails-users-count-inconsistency-page-56/143431)._
