# Postgresql time-out issue

**URL:** <https://community.grafana.com/t/postgresql-time-out-issue/6644>\
**Category:** PostgreSQL\
**Tags:** postgres\
**Created:** [April 6, 2018, 5:58am UTC](https://community.grafana.com/t/postgresql-time-out-issue/6644 "2018-04-06T05:58:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gapvision](https://avatars.discourse-cdn.com/v4/letter/g/e36b37/32.png) [@gapvision](https://community.grafana.com/u/gapvision)\
**Post date:** [April 6, 2018, 5:58am UTC](https://community.grafana.com/t/postgresql-time-out-issue/6644/1 "2018-04-06T05:58:26Z")

</div>

Hello, I recently started to use a postgresql datasource in my Grafana dashboards. Unfortunately it seems to run into some timeout issue for more complex queries after approx. 1 minute (“request error” without further details).

Can you confirm that there is such a time limit and is there a way to extend it?

Best,

---

<div class="post-metadata">

**Author:** ![daniellee](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/daniellee/32/41_2.png) [@daniellee](https://community.grafana.com/u/daniellee)\
**Post date:** [April 6, 2018, 3:46pm UTC](https://community.grafana.com/t/postgresql-time-out-issue/6644/2 "2018-04-06T15:46:47Z")

</div>

I thought the timeout was 30 seconds - if you look in your Chrome Dev Tools console, do you get a more detailed error there? (Or in the grafana server logs).

Long queries is very much an edge case for Grafana. Most timeseries queries should complete within in a second or two.

There is a feature request for adding a configuration option for query timeouts but it is not implemented: [https://github.com/grafana/grafana/issues/3168](https://github.com/grafana/grafana/issues/3168)

---

<div class="post-metadata">

**Author:** ![georgehazboun1997](https://avatars.discourse-cdn.com/v4/letter/g/35a633/32.png) [@georgehazboun1997](https://community.grafana.com/u/georgehazboun1997)\
**Post date:** [November 7, 2023, 11:16am UTC](https://community.grafana.com/t/postgresql-time-out-issue/6644/3 "2023-11-07T11:16:53Z")

</div>

@gapvision  
were you able to find a solution? I’m facing the same issue

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [November 7, 2023, 6:58pm UTC](https://community.grafana.com/t/postgresql-time-out-issue/6644/4 "2023-11-07T18:58:26Z")

</div>

Welcome @georgehazboun1997

Could you please share your query?

---

<div class="post-metadata">

**Author:** ![pdroslva84](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@pdroslva84](https://community.grafana.com/u/pdroslva84)\
**Post date:** [March 19, 2024, 12:30pm UTC](https://community.grafana.com/t/postgresql-time-out-issue/6644/5 "2024-03-19T12:30:02Z")

</div>

@yosiasz

I’m having the same issue. I can easily reproduce the timeout with the `pg_sleep` command:

- `SELECT pg_sleep(40);` =\> no timeout
- `SELECT pg_sleep(70);` =\> timeout

So there seems to be a hard 1 minute timeout somewhere but I can’t find where to override it. I already tried the timeout variables in grafana.ini

Any ideas?

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [March 19, 2024, 2:48pm UTC](https://community.grafana.com/t/postgresql-time-out-issue/6644/6 "2024-03-19T14:48:10Z")

</div>

well, same question to you. we cant see your query remotely. Also try the same query that times out in grafana, in a pg query tool how long does it take?

---

<div class="post-metadata">

**Author:** ![pdroslva84](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@pdroslva84](https://community.grafana.com/u/pdroslva84)\
**Post date:** [March 19, 2024, 3:07pm UTC](https://community.grafana.com/t/postgresql-time-out-issue/6644/7 "2024-03-19T15:07:09Z")

</div>

I don’t see how sharing the query here will help. My issue is not with the query, I already know it takes a long time, more than a minute, whether through grafana or any other tool.

The timeout however only happens in grafana, hence my question (and I suppose other people’s in this thread as well): is there a way to configure this timeout limit?

---

<div class="post-metadata">

**Author:** ![alexitheodore](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@alexitheodore](https://community.grafana.com/u/alexitheodore)\
**Post date:** [August 8, 2024, 6:47pm UTC](https://community.grafana.com/t/postgresql-time-out-issue/6644/8 "2024-08-08T18:47:18Z")

</div>

I have come up against the same issue and done some diagnostics that make this pretty clear. The timeout on my setup seems to be 30 seconds exactly. I did this using the pg\_sleep(n) method where I tested n increasing over time and monitored the network console to see when the response came back. Any value of n \>= 30 produced an error after 30 seconds.

So thats pretty clear. The question then is… how does one modify this setting?
