Database conection
fvr1
PROOP

6 months ago

Hi, I need to increment the capacity of my productive database, is being way too slow and getting stuck. I need to restart it for it to start working again...

What could I do??

$10 Bounty

10 Replies

Railway
BOT

6 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!


fvr1
PROOP

6 months ago

also, is there any tool you could recommend for monitoring the postgres db? get metrics like avg response time, most used queries, etc?


6 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open david 6 months ago


fra
HOBBYTop 10% Contributor

6 months ago

railway dbs are not managed, so you need to implement your own metrics, did add the right indexes? can you check for slow queries? what's the current workload? cpu/memory & volume?


6 months ago

Hey there fvr1! I'm a bit confused, do you mean that you're looking to increase your database storage capacity?
Or are you trying to speed it up?


noahd

Hey there fvr1! I'm a bit confused, do you mean that you're looking to increase your database storage capacity? Or are you trying to speed it up?

fvr1
PROOP

6 months ago

Hi!! Thanks for your reply!

I'm trying to speed it up. I'm looking for a quick action to do if the productive database get stuck, like doing a "vertical scaling" till we can find a better solution, is that posible?

In terms of storage capacity we are ok, but in the future, if we have a capacity problem what do you suggest to do?


fra

railway dbs are not managed, so you need to implement your own metrics, did add the right indexes? can you check for slow queries? what's the current workload? cpu/memory & volume?

fvr1
PROOP

6 months ago

Hi!!
Thanks for your reply!

I just started looking the metrics on postgres and fixing / removing / creating some indexes.
In terms of the workload, we had an spike on traffic that created the error, but the metrics of the "machine" seemed fine.


Also, I haven't enabled (yet) the pg_stat_statements so I'm missing the stats on queries. I was hoping there was some "UI" way to do the configuration on Postgres, but I'm not finding it.

What do you recommend for my case?


colinrm000
HOBBY

6 months ago

I am going to try to answer some of your listed questions here.

To understand why queries are slow, you’ll want better visibility.
You've already brought it up, but I would enable pg_stat_statements .

Then run something like:

SELECT query, total_exec_time, calls

FROM pg_stat_statements

ORDER BY total_exec_time DESC

LIMIT 10;

This will show you which queries are using the most time.

As for tools to add on top of this for monitoring, I would try PgHero.
PgHero is a lightweight web UI that shows query stats, slow queries, cache hit rates, etc. Which sounds like what you're looking for.
Pairing that with pg_stat_statements should give you a real picture of query performance.

For resilience down the line: optimize indexes, and consider replicas/partitioning as traffic grows.


fvr1

Hi!!Thanks for your reply!I just started looking the metrics on postgres and fixing / removing / creating some indexes.In terms of the workload, we had an spike on traffic that created the error, but the metrics of the "machine" seemed fine. Also, I haven't enabled (yet) the pg_stat_statements so I'm missing the stats on queries. I was hoping there was some "UI" way to do the configuration on Postgres, but I'm not finding it.What do you recommend for my case?

fra
HOBBYTop 10% Contributor

6 months ago

I'd check also the volume, if the volume is almost full it might slow down the db, is your db in the same region of your services?


fra

I'd check also the volume, if the volume is almost full it might slow down the db, is your db in the same region of your services?

fvr1
PROOP

6 months ago

Thanks for pointing out the region, I didn't have it on the same one!

About the volume it's ok.


6 months ago

To clarify, did changing region solve the issue?


Loading...