query replica postgresql


For security reasons, users must query a replica database that is updated by an intermediate replica.
We must ensure performance and that requests do not impact replication. How to proceed ?

Thank you

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Doug WaltonDatabase AdministratorCommented:
If you don't have any already you should have some monitoring on the server itself to alert when the resources on the machine have been high for a while (CPU, disk, RAM).  If one of them is at 100% for too long replication could start slowing down.

One other thing you can do would be write a script that checks pg_stat_activity for select queries that have been running for a while.  You could kill them automatically with the same script, but it would probably be safer to send a notification to yourself and kill it manually if it needs to be killed.

select * from pg_stat_activity where current_date - query_start >= interval '10 minutes';

Open in new window

There are also some free postgres monitoring tools out there that can provide some detailed graphs, but a couple scripts to do the things I said above would probably be all you need for a replica database.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bibi92Author Commented:
Thank you best regards
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.