# Search query times out for big sites

**URL:** <https://meta.discourse.org/t/search-query-times-out-for-big-sites/138267>\
**Category:** Development\
**Created:** [10 januari 2020 om 19:28 UTC](https://meta.discourse.org/t/search-query-times-out-for-big-sites/138267 "2020-01-10T19:28:14Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Eduardo\_Poleo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eduardo_poleo/32/155764_2.png) [@Eduardo\_Poleo](https://meta.discourse.org/u/Eduardo_Poleo)\
**Post date:** [10 januari 2020 om 19:28 UTC](https://meta.discourse.org/t/search-query-times-out-for-big-sites/138267/1 "2020-01-10T19:28:15Z")

</div>

Hey guys,

We’re started seeing timeouts regularly on our `/search` query, we’ve benchmarked some search terms and some queries might take up to 2mins to complete. We found this [post](https://meta.discourse.org/t/502-bad-gateway-on-specific-searches/104616/5) but were wondering if they are any additional recommendations on how to deal with this. Some relevant information related to our particular case:

- Our biggest site (the one that’s timing out more often) has about 1,700,000 posts.
- We are using some default postgresql autovacuum settings. We gathered some stats around the pertinent tables: `categories` , `posts` , `topics` , `post_search_data` , `users` and they seemed to get vacuumed about once a day so we do not think this has to do with dead rows slowing down our search.
- We’ve manually run the `Jobs::ReindexSearch.new({})` but did not see any considerable improvement

We’re considering running the `rake search:reindex` on that site which we know already will take quite a while but we are wondering if you have any other suggestion?

Thank you in advance

---

_[View the full topic](https://meta.discourse.org/t/search-query-times-out-for-big-sites/138267)._
