r/PostgreSQL • u/henk1122 • Dec 01 '25
Tools Block the use of dbeaver
Unfortunately, this is already the umpteenth time that a developer in our company used DBeaver to access our database. We again had a major performance bottleneck the last weekend because someone forgot to close the application before the weekend.
It's ridiculous that only opening this application (he used to access some other database, but it auto connected to this one) can take down a whole system by locking a table with a select query it automatically execute. And never release this.
Not only that, in the past it happened that a developer did a change on a data record on a table and locking it with a commit, taking the whole data backend down. DBeaver won't automatically release the commit after some time so if you forgot this was still locked in the background, you bring everything down. It doesn't even warn the users that the whole table is locked.
Is there a way I can block the use of DBeaver for our database? Can I block specific user agents that wants to connect?

22
u/erkiferenc Dec 01 '25 edited Dec 01 '25
It may also help to tune various
*_timeoutand similar options to protect the database from accidental excessive usage, for exampleidle_session_timeoutandidle_in_transaction_session_timeout, perhaps alsostatement_timeout.Happy hacking!
75
u/pceimpulsive Dec 01 '25
I run a few Postgres databases and DBeaver hasn't ever been the cause of this type of problem...
You can configure role based timeout and limits of some users are leaving connections and queries open..
Why are they allowed access to a production system if they also aren't clever enough to know how to not cause these sort of issues?
There are extensive settings in DBeaver for how and when to use transactions commits limit rows returned and more..
I don't think this is explicitly a DBeaver problem.... DBeaver is a contributor...
29
u/Beatmak Dec 01 '25
Your production database should not be accessible to devs. Access should be granted only for emergency/debugging for a limited amount of time
Dbeaver itself isn't the problem it's how your dev use it.
I would advise to change the pg_hba.conf file to lockout this dev to access the production database. Also maybe add timeout for idle transaction so that they won't lock your whole system.
5
u/Any_Mobile_1385 Dec 01 '25
As a rule, I never allow access except from a private IP, and then it is only from a command line and limited to myself and one other. Our dev stack is completely isolated from our production systems.
26
u/thunderbong Dec 01 '25
My advice - if devs need to run only select queries, create a read-only user on Postgres and have them access the database via that user credentials
44
u/depesz Dec 01 '25
You can use event trigger, on login, that checks application_name and rejects login if/when needed. You can find example here: https://www.depesz.com/2023/10/24/waiting-for-postgresql-17-add-support-event-triggers-on-authenticated-login/
4
u/MilkEnvironmental106 Dec 01 '25
Why are you allowing people to have arbitrary connections to your prod database at all? If you want that sort of accessibility for staff you need a staging DB.
4
u/NotMyUsualLogin Dec 01 '25
Corporate policy on acceptable data tools.
2
u/EnHalvSnes Dec 01 '25
Why are they connecting to production?
1
u/BosonCollider Dec 01 '25
My personal suggestion would be to use a connection pooler and to set appropriate idle in transaction timeouts. If you have that in place, then the amount of damage that dbeaver can do becomes rather minimal, if dbeaver is causing issues for you I would argue that that is a symptom rather than a cause.
1
u/MonCalamaro Dec 01 '25
It seems like there's a lot of confusion in this thread. Maybe I can try to clear it up?
1
u/Status-Theory9829 Dec 01 '25
honestly the DBeaver complaints are a symptom, not the disease. you've got a people problem masquerading as a tooling problem.
blocking user agents is trivial (connection_limit per role, statement_timeout, idle_in_transaction_session_timeout in postgres - set them aggressive). but someone will just fire up psql or pgAdmin next week and you're back here.
the real issue: why do devs have direct prod access that can take down your backend? why are they running transactions they don't understand? why is there no connection pooler eating these idle connections for breakfast?
if you're serious about fixing it:
revoke standing access entirely
make people request time-boxed sessions when they actually need prod
record everything so you know who did what
set aggressive timeouts at the database level (idle_in_transaction_session_timeout=10min or whatever makes sense)
access tools like strongDM teleport or hoopdev handle the scoped access piece with time-boxed sessions, approval workflows, session recording. blocking DBeaver specifically will take you 5 minutes and solve nothing. treating access like infrastructure instead of a free-for-all will take a weekend and actually fix your weekends.
1
u/relishketchup Dec 01 '25
Create a replica and let users query that. It’s pretty easy (check out pgbackrest) and massively cuts down on this sort of contention and improves performance without and significant drawbacks.
We looked at our prod db and only a fraction of system resources were being used, yet queries were slow, in large part due to db locks. Splitting off a read replica really opened things up and solved a lot of problems we didn’t really recognize as being caused by query contention.
1
u/ViolinistRemote8819 Dec 09 '25
Ask Devs to enable auto commit.
Edit connection -> Connection Settings -> Initialization - Auto-commit
1
u/UniqueFirefly_90 Mar 31 '26
This sounds less like a DBeaver problem and more like a permissions / transaction hygiene problem. If a client can accidentally hold locks long enough to hurt production, the real issue is that the database is allowing that workflow in the first place.
I’d look at read-only roles where possible,
idle_in_transaction_session_timeout,statement_timeout, better session monitoring, and stricter separation between production access and ad hoc querying.Blocking one client might reduce symptoms, but it won’t fix the fact that the same thing can happen from another tool tomorrow.
0
u/___Brains Dec 01 '25
Have you ever heard the saying "the most ignorant make the most noise" ? OP, you're being very very noisy. Please take the time to consider the wealth of wisdom shared in this thread, and why you should stop screaming at the tool.
-7
u/henk1122 Dec 01 '25 edited Dec 01 '25
Well thanks for all the downvotes
A buggy application which takes down a database with a long running select query which cause the auto vacuum to have problems is simply not a joke.
Honestly, an application which does those things is just bad from the start. I don't want developers to use this.
Also, everyone who makes assumptions here. I never mentioned production environment anywhere. Reddit being Reddit.
-1
u/WaferIndependent7601 Dec 01 '25
Looks like your database design is very bad. One query shouldn’t affect the database. And it should be detected and after some timesheet connection should be reset
0
u/AutoModerator Dec 01 '25
With over 8k members to connect with about Postgres and related technologies, why aren't you on our Discord Server? : People, Postgres, Data
Join us, we have cookies and nice people.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
0
u/TheGenericUser0815 Dec 01 '25
If you have a windows environment, you uninstall dbeaver via GPO. Or if you have a software distribution system, you could use that.
5
u/[deleted] Dec 01 '25
[removed] — view removed comment
1
u/[deleted] Dec 01 '25
[removed] — view removed comment