Postgres is very slow
alandotcom
PROOP

3 months ago

Same issues as this thread https://station.railway.com/questions/postgres-is-slow-8aaee381 both development and production environments.

Query times are highly variables. Sometimes I see a commit take over 1 second to complete, and this is on a very low traffic instance.

Solved

18 Replies

Railway
BOT

3 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


alandotcom
PROOP

3 months ago

These logs are probably relevant (noting spikes in checkpoint sync times)

```
2025-09-06 17:43:14.344 UTC [27] LOG: checkpoint starting: time

2025-09-06 17:43:16.834 UTC [27] LOG: checkpoint complete: wrote 22 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.118 s, sync=0.269 s, total=2.490 s; sync files=19, longest=0.235 s, average=0.015 s; distance=2 kB, estimate=1401 kB; lsn=0/2E893E8, redo lsn=0/2E893B0

2025-09-07 16:38:40.982 UTC [27] LOG: checkpoint starting: time

2025-09-07 16:38:43.788 UTC [27] LOG: checkpoint complete: wrote 22 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.136 s, sync=0.417 s, total=2.807 s; sync files=22, longest=0.383 s, average=0.019 s; distance=10 kB, estimate=1262 kB; lsn=0/2E8BC48, redo lsn=0/2E8BC10

2025-09-07 16:43:40.852 UTC [27] LOG: checkpoint starting: time

2025-09-07 16:43:45.912 UTC [27] LOG: checkpoint complete: wrote 51 buffers (0.3%); 0 WAL file(s) added, 0 removed, 0 recycled; write=5.020 s, sync=0.012 s, total=5.061 s; sync files=42, longest=0.007 s, average=0.001 s; distance=26 kB, estimate=1138 kB; lsn=0/2E92570, redo lsn=0/2E92538

2025-09-08 00:28:49.837 UTC [27] LOG: checkpoint starting: time

2025-09-08 00:28:59.040 UTC [27] LOG: checkpoint complete: wrote 62 buffers (0.4%); 0 WAL file(s) added, 0 removed, 0 recycled; write=6.326 s, sync=0.080 s, total=9.203 s; sync files=46, longest=0.079 s, average=0.002 s; distance=238 kB, estimate=1048 kB; lsn=0/2ECE0B0, redo lsn=0/2ECE040

2025-09-08 00:33:49.138 UTC [27] LOG: checkpoint starting: time

2025-09-08 00:34:18.279 UTC [27] LOG: checkpoint complete: wrote 29 buffers (0.2%); 0 WAL file(s) added, 0 removed, 0 recycled; write=7.719 s, sync=14.148 s, total=29.142 s; sync files=26, longest=4.232 s, average=0.545 s; distance=27 kB, estimate=946 kB; lsn=0/2ED4FE0, redo lsn=0/2ED4FA8

2025-09-08 01:48:50.678 UTC [27] LOG: checkpoint starting: time

2025-09-08 01:48:51.533 UTC [27] LOG: checkpoint complete: wrote 8 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.720 s, sync=0.047 s, total=0.855 s; sync files=8, longest=0.040 s, average=0.006 s; distance=29 kB, estimate=854 kB; lsn=0/2EDC568, redo lsn=0/2EDC530

2025-09-08 01:58:50.722 UTC [27] LOG: checkpoint starting: time

2025-09-08 01:58:53.034 UTC [27] LOG: checkpoint complete: wrote 23 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.222 s, sync=0.026 s, total=2.312 s; sync files=23, longest=0.023 s, average=0.002 s; distance=11 kB, estimate=770 kB; lsn=0/2EDF460, redo lsn=0/2EDF428

2025-09-10 19:33:58.155 UTC [15737] LOG: could not receive data from client: Connection reset by peer

2025-09-10 19:35:05.822 UTC [27] LOG: checkpoint starting: time

2025-09-10 19:35:16.850 UTC [27] LOG: checkpoint complete: wrote 13 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=3.257 s, sync=3.456 s, total=11.028 s; sync files=11, longest=3.189 s, average=0.315 s; distance=14 kB, estimate=694 kB; lsn=0/2EE3000, redo lsn=0/2EE2FC8

2025-09-10 19:40:05.950 UTC [27] LOG: checkpoint starting: time

2025-09-10 19:40:10.514 UTC [27] LOG: checkpoint complete: wrote 7 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.618 s, sync=1.937 s, total=4.565 s; sync files=7, longest=1.923 s, average=0.277 s; distance=5 kB, estimate=625 kB; lsn=0/2EE45A8, redo lsn=0/2EE4570

2025-09-10 19:55:05.800 UTC [27] LOG: checkpoint starting: time

2025-09-10 19:55:36.189 UTC [27] LOG: checkpoint complete: wrote 30 buffers (0.2%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.851 s, sync=7.981 s, total=30.389 s; sync files=30, longest=5.232 s, average=0.267 s; distance=21 kB, estimate=565 kB; lsn=0/2EE9C60, redo lsn=0/2EE9BF0
```


alandotcom

These logs are probably relevant (noting spikes in checkpoint sync times)```2025-09-06 17:43:14.344 UTC [27] LOG: checkpoint starting: time2025-09-06 17:43:16.834 UTC [27] LOG: checkpoint complete: wrote 22 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.118 s, sync=0.269 s, total=2.490 s; sync files=19, longest=0.235 s, average=0.015 s; distance=2 kB, estimate=1401 kB; lsn=0/2E893E8, redo lsn=0/2E893B02025-09-07 16:38:40.982 UTC [27] LOG: checkpoint starting: time2025-09-07 16:38:43.788 UTC [27] LOG: checkpoint complete: wrote 22 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.136 s, sync=0.417 s, total=2.807 s; sync files=22, longest=0.383 s, average=0.019 s; distance=10 kB, estimate=1262 kB; lsn=0/2E8BC48, redo lsn=0/2E8BC102025-09-07 16:43:40.852 UTC [27] LOG: checkpoint starting: time2025-09-07 16:43:45.912 UTC [27] LOG: checkpoint complete: wrote 51 buffers (0.3%); 0 WAL file(s) added, 0 removed, 0 recycled; write=5.020 s, sync=0.012 s, total=5.061 s; sync files=42, longest=0.007 s, average=0.001 s; distance=26 kB, estimate=1138 kB; lsn=0/2E92570, redo lsn=0/2E925382025-09-08 00:28:49.837 UTC [27] LOG: checkpoint starting: time2025-09-08 00:28:59.040 UTC [27] LOG: checkpoint complete: wrote 62 buffers (0.4%); 0 WAL file(s) added, 0 removed, 0 recycled; write=6.326 s, sync=0.080 s, total=9.203 s; sync files=46, longest=0.079 s, average=0.002 s; distance=238 kB, estimate=1048 kB; lsn=0/2ECE0B0, redo lsn=0/2ECE0402025-09-08 00:33:49.138 UTC [27] LOG: checkpoint starting: time2025-09-08 00:34:18.279 UTC [27] LOG: checkpoint complete: wrote 29 buffers (0.2%); 0 WAL file(s) added, 0 removed, 0 recycled; write=7.719 s, sync=14.148 s, total=29.142 s; sync files=26, longest=4.232 s, average=0.545 s; distance=27 kB, estimate=946 kB; lsn=0/2ED4FE0, redo lsn=0/2ED4FA82025-09-08 01:48:50.678 UTC [27] LOG: checkpoint starting: time2025-09-08 01:48:51.533 UTC [27] LOG: checkpoint complete: wrote 8 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.720 s, sync=0.047 s, total=0.855 s; sync files=8, longest=0.040 s, average=0.006 s; distance=29 kB, estimate=854 kB; lsn=0/2EDC568, redo lsn=0/2EDC5302025-09-08 01:58:50.722 UTC [27] LOG: checkpoint starting: time2025-09-08 01:58:53.034 UTC [27] LOG: checkpoint complete: wrote 23 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.222 s, sync=0.026 s, total=2.312 s; sync files=23, longest=0.023 s, average=0.002 s; distance=11 kB, estimate=770 kB; lsn=0/2EDF460, redo lsn=0/2EDF4282025-09-10 19:33:58.155 UTC [15737] LOG: could not receive data from client: Connection reset by peer2025-09-10 19:35:05.822 UTC [27] LOG: checkpoint starting: time2025-09-10 19:35:16.850 UTC [27] LOG: checkpoint complete: wrote 13 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=3.257 s, sync=3.456 s, total=11.028 s; sync files=11, longest=3.189 s, average=0.315 s; distance=14 kB, estimate=694 kB; lsn=0/2EE3000, redo lsn=0/2EE2FC82025-09-10 19:40:05.950 UTC [27] LOG: checkpoint starting: time2025-09-10 19:40:10.514 UTC [27] LOG: checkpoint complete: wrote 7 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.618 s, sync=1.937 s, total=4.565 s; sync files=7, longest=1.923 s, average=0.277 s; distance=5 kB, estimate=625 kB; lsn=0/2EE45A8, redo lsn=0/2EE45702025-09-10 19:55:05.800 UTC [27] LOG: checkpoint starting: time2025-09-10 19:55:36.189 UTC [27] LOG: checkpoint complete: wrote 30 buffers (0.2%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.851 s, sync=7.981 s, total=30.389 s; sync files=30, longest=5.232 s, average=0.267 s; distance=21 kB, estimate=565 kB; lsn=0/2EE9C60, redo lsn=0/2EE9BF0```

alandotcom
PROOP

3 months ago

Query times look good, but I see large latency spikes >1second during COMMITs


Railway
BOT

3 months ago

Hello!

We're acknowledging your issue and attaching a ticket to this thread.

We don't have an ETA for it, but, our engineering team will take a look and you will be updated as we update the ticket.

Please reply to this thread if you have any questions!


jake
EMPLOYEE

3 months ago

Ticket attached. We're looking into this internally


Status changed to Awaiting User Response Railway 3 months ago


alandotcom
PROOP

2 months ago

Still seeing this issue sporadically. median latencies are like 10-20ms, with tail latencies around 900ms


Status changed to Awaiting Railway Response Railway 3 months ago


echohack
EMPLOYEE

2 months ago

Thank you for the continued report. We do see increased latency on this host, particularly on the hour, and on midnight. We're working on a mitigation and strategy for ensuring disk latency is good going forward.


Status changed to Awaiting User Response Railway 2 months ago


echohack

Thank you for the continued report. We do see increased latency on this host, particularly on the hour, and on midnight. We're working on a mitigation and strategy for ensuring disk latency is good going forward.

alandotcom
PROOP

2 months ago

Thank you. I can also dig up timestamps for the latency spikes (using Sentry for tracing) if that’s helpful


Status changed to Awaiting Railway Response Railway 2 months ago


alandotcom

Thank you. I can also dig up timestamps for the latency spikes (using Sentry for tracing) if that’s helpful

ray-chen
EMPLOYEE

2 months ago

That would be really helpful! We've made some changes here so hopefully these spikes should go away. Please do let us know if you're still running into this


Status changed to Awaiting User Response Railway 2 months ago


ray-chen

That would be really helpful! We've made some changes here so hopefully these spikes should go away. Please do let us know if you're still running into this

alandotcom
PROOP

2 months ago

So far looking good, thank you


Status changed to Awaiting Railway Response Railway 2 months ago


Status changed to Solved itsrems 2 months ago


Railway
BOT

2 months ago

✅ The ticket Performance issue with disk operations on metal has been marked as completed.


Railway
BOT

2 months ago

🛠️ The ticket Performance issue with disk operations on metal has been marked as in progress.


Railway
BOT

2 months ago

✅ The ticket Performance issue with disk operations on metal has been marked as completed.


Railway
BOT

2 months ago

🛠️ The ticket Performance issue with disk operations on metal has been marked as in progress.


Railway
BOT

2 months ago

🛠️ The ticket Performance issue with disk operations on metal has been marked as in progress.


Railway
BOT

2 months ago

🛠️ The ticket Performance issue with disk operations on metal has been marked as in progress.


Railway
BOT

2 months ago

✅ The ticket Performance issue with disk operations on metal has been marked as completed.


Railway
BOT

2 months ago

✅ The ticket Performance issue with disk operations on metal has been marked as completed.


Loading...