---
title: "How to run a large SQL file without opening it"
description: "Most SQL editors can't open a 300 MB dump. Run a large .sql file from disk with mysql or psql, or with Run SQL File in Jam SQL Studio."
url: "https://jamsql.com/blog/2026-11-07-run-large-sql-file/"
html_url: "https://jamsql.com/blog/2026-11-07-run-large-sql-file/"
generated: "2026-11-17T22:27:06.223Z"
---

Published: 2026-11-07

# How to run a large SQL file without opening it

A database dump of a few hundred megabytes is too big for most SQL editors, because they read the whole file into memory before they show it. To run a file like that you use the database's command-line client, or, since Jam SQL Studio 1.5.9, **Run SQL File**, which runs a `.sql` file on a saved connection straight from disk. This post covers why editors refuse big files, the command-line way, and how to run one in Jam SQL Studio.

## Why a SQL editor won't open a large dump

A query editor keeps the full text in memory and does more work on top of it: syntax highlighting, error checking and an undo history. A `mysqldump` or `pg_dump --inserts` file is mostly `INSERT` statements, each one a single long line holding thousands of rows. Open a few hundred megabytes of that and the editor either freezes for minutes or runs out of memory.

Jam SQL Studio's editor accepts files up to 50 MB and refuses larger ones before reading them. Until 1.5.9 the refusal told you to use the command-line client. Then a user restoring a MySQL dump asked whether the limit could be removed. The limit stays, because it keeps the editor from running out of memory. You rarely need to read a dump anyway, only to run it, so 1.5.9 added a way to run a file without opening it.

## The command-line way

Every engine ships a client that runs a file without an editor:

```bash
mysql -h db-host -u app -p shop_restore < shop-2026-11-07.sql
psql -h db-host -U app -d shop_restore -f shop.sql
sqlcmd -S db-host -U app -d Shop -i shop.sql
sqlplus app@db-host/FREEPDB1 @shop.sql
sqlite3 shop.db ".read shop.sql"
```

This works, but you need the client installed (a Mac has none of them by default), you type the host, login and password again even though your SQL tool already has them saved, and you see no progress until the client finishes. The `mysql` client also stops at the first error unless you pass `--force`.

## Run SQL File in Jam SQL Studio

### 1\. Open it

When you open a `.sql` file over 50 MB, the message that refuses it has a **Run SQL File…** button. You can also start from **More → Run SQL File…** in the toolbar or from the command palette.

![The File too large for the editor message over the query editor: the file is 62 MB, the editor accepts SQL up to 50 MB, and a Run SQL File… button runs it without opening it](/images/docs/run-sql-file-too-large-toast.png)
*Opening a file over 50 MB shows this message instead of a new tab.*

### 2\. Choose where it runs

The dialog shows the file, its size, and the connection and database it will run in, both taken from the active query tab. You can pick another connected connection or another database. **Continue after errors** is off, so by default the run stops at the first statement that fails.

![The Run SQL File dialog before the run: the file shop-2026-11-07.sql, 62 MB, the MySQL dev connection and the shop_restore database, the Continue after errors checkbox, and Cancel and Run buttons](/images/docs/run-sql-file-setup.png)
*The setup view before **Run**.*

### 3\. Run it

Jam SQL Studio reads the file twice and never holds all of it in memory. The first pass counts the statements without running any of them; the second runs them one at a time on a connection opened for this run. The dialog shows the line in progress, how much of the file has run, and the statement, error and row counts. You can close the dialog and keep working: **Keep running** lets the run finish, and a message appears when it ends.

![The Run SQL File dialog during a run: running the statement on line 184, 19 MB of 62 MB run, 158 of 669 statements, 0 failed, 296,000 rows affected, 12 seconds elapsed, with Close and Stop buttons](/images/docs/run-sql-file-running.png)
*Twelve seconds into a 62 MB `mysqldump` file.*

The file in these screenshots is a 62 MB `mysqldump` of two tables. On a local MySQL 8.0 server it ran in 32 seconds: 669 statements and 1,294,000 rows.

![The Run SQL File result: ran 669 statements, 669 of 669, 0 failed, 1,294,000 rows affected, duration 0:32, with Run another file… and Close buttons](/images/docs/run-sql-file-result.png)

### 4\. Read the errors

With **Continue after errors** ticked, the run goes on past a failed statement and lists each failure with its line number, the server's message and the start of the statement. **Copy** puts the list on the clipboard.

![The Run SQL File result for a migration file: ran 6 statements, 2 failed. The error list shows line 4, table shop_restore.order_notes doesn't exist, and line 6, duplicate entry 1 for key orders.PRIMARY, each with the start of the statement, and a Copy button](/images/docs/run-sql-file-result-errors.png)
*A migration file with two failing statements, run with Continue after errors.*

## Before you run a dump

-   **Each statement is committed as it runs.** Statements that ran before an error or a Stop stay applied, so restore into an empty database that is easy to drop and start again.
-   **The file is one session.** A `USE`, a `SET` or a temporary table in the file carries on to the statements after it, and none of it changes your query tabs.
-   **Statements are cut the way the database's own client cuts them:** `DELIMITER` blocks in `mysqldump` files, `GO` batches on SQL Server, a `/` after a PL/SQL block on Oracle. UTF-16 files, which SQL Server Management Studio's Generate Scripts saves by default, run too.
-   **One statement can be up to 64 MB** (MySQL's default `max_allowed_packet`). The file itself has no size limit.
-   **Default `pg_dump` files are refused.** They hold table data as `COPY … FROM stdin` blocks, which only `psql` can feed to the server. The dialog names the line before anything runs. Create the dump with `pg_dump --inserts`, or run it with `psql`.

![The Run SQL File result for a default pg_dump file: nothing was run. Line 20: COPY … FROM stdin with its data in the file. Run SQL File runs SQL statements only; re-run pg_dump with --inserts, or run this file with psql](/images/docs/run-sql-file-refused-copy.png)
*A `pg_dump` file with `COPY` data is refused before any statement runs.*

Run SQL File is in the desktop app for SQL Server, PostgreSQL, MySQL and MariaDB, Oracle and SQLite connections. The [Query Editor docs](/docs/query-editor/#run-sql-file) cover the rest: Stop, lost connections, files that change during a run, and the full list of files that are refused.

## Quick Answers

### Q: How do I run a SQL file that is too large to open in an editor?

Run it from disk instead of opening it: with the database's command-line client (mysql, psql, sqlcmd, sqlplus or sqlite3), or in Jam SQL Studio 1.5.9 and later with **More → Run SQL File…**, which runs the file on a saved connection without loading it into the editor and shows progress and failed statements.

### Q: Can Run SQL File run a pg\_dump file?

Only a plain SQL one. By default `pg_dump` writes table data as `COPY … FROM stdin` blocks, which only `psql` can feed to the server, so Run SQL File refuses such a file before running anything and names the line. Create the dump with `pg_dump --inserts`, or run it with `psql`.

### Q: What happens when a statement in the file fails?

By default the run stops at the first failed statement. With **Continue after errors** ticked it runs the rest of the file and lists every failure with its line number and the server's message. Each statement is committed as it runs, so the statements that ran before an error stay applied.

## Run SQL File in Jam SQL Studio

Run SQL File runs a .sql file of any size on a SQL Server, PostgreSQL, MySQL, Oracle or SQLite connection without opening it in the editor, with progress, Stop and a list of the statements that failed.

[Download Jam SQL Studio Free](/download/) [Run SQL File docs](/docs/query-editor/#run-sql-file)

Free for personal use • No account required • Mac, Windows, Linux