Skip to content

Cancelling the execution of a long-running SQL script

If a query is taking longer than expected, you can stop it without waiting for it to finish.

To stop it, click Stop on the strip that appears above the grid while the work is running.

That strip is the only way to stop it. Version 5 also offered SQL → Stop Query and a toolbar button of the same name, and both are gone: a command that is worth anything only while something is running belongs beside the thing that is running, not in a menu you have to go and find. Esc no longer cancels either.

SQLite Expert asks SQLite to interrupt the running statement and returns control to you.

While a read is running

Work that takes more than a moment says so. A strip appears above the grid with what is being done and a Stop button beside it: rows read as they arrive, or Scanning where the engine cannot say how far it has got — sorting on an unindexed column, for instance, produces nothing at all until the sort is finished, so there is no row number to report.

The strip is deliberately slow to appear. Work that finishes quickly never shows it, which keeps it from flickering on every keystroke in the filter row.

It covers reading a large table, sorting, filtering, and the statements a script runs, so the Data, SQL and Scripting tabs all report the same way.

Stopping a script rather than a statement

On the Scripting tab, Stop ends the script. Earlier versions stopped only the statement that was running at the time, so a script that ran a slow query inside a loop would stop that one query and carry straight on to the next.

Note

Cancelling stops the current statement as soon as SQLite can safely do so. Any statements that already completed remain in effect — unless you were running inside a transaction, in which case you can roll it back to undo them.

See also: Executing SQL scripts