Running a Large SQL Script in DBeaver Without It Freezing
DBeaver loads the whole script into the editor by default and runs out of memory. Use Execute SQL Script (file mode) instead — here's how.
Open a 500MB .sql file in DBeaver's SQL editor and watch it freeze or throw an OutOfMemoryError. The problem isn't your database — it's that DBeaver tries to load the entire file into the editor first. The fix is to never open it in the editor at all.
Use 'Execute SQL Script' on the file directly
- Right-click your target database/schema in the Database Navigator
- Choose Tools → Execute SQL Script (or SQL Editor → Execute script from file)
- Pick the .sql file from disk
- DBeaver streams the file statement by statement instead of loading it into the editor
This streaming mode is the single most important setting for large imports. The editor-based 'Execute Script' (Alt+X on an open file) is what causes the freeze.
Give DBeaver more heap
DBeaver is a Java app with a fixed heap ceiling. Raise it in dbeaver.ini (next to the executable):
-Xmx2048mBump -Xmx to 2048m or higher, save, and restart DBeaver. The default is often too low for big result sets and scripts.
In the toolbar, switch the transaction mode to Manual and commit once at the end. Committing after every statement is dramatically slower on a big import.
When the file is genuinely huge
Even in streaming mode, a multi-GB script that fails near the end forces you to start over. Splitting it lets you run and verify each part, and re-run only what failed.
Frequently Asked Questions
Why does DBeaver freeze when I open a large SQL file?
The SQL editor loads the entire file into memory before running it. For large files this exhausts the Java heap. Use Tools → Execute SQL Script on the file directly, which streams it statement by statement instead of opening it in the editor.
How do I increase DBeaver's memory?
Edit dbeaver.ini and raise the -Xmx value (e.g. -Xmx2048m), then restart DBeaver. This increases the Java heap available for large scripts and result sets.
What's the fastest way to import a big script in DBeaver?
Use file-based Execute SQL Script, switch the transaction mode to Manual so it commits once at the end, and split very large files so each runs quickly and failures are recoverable.