Stopping queries

If a query runs indefinitely, you may need to stop it. This page provides general guidelines for safely terminating queries in different TypeDB clients.

Is it safe to interrupt queries?

Yes. Read queries do not alter the database and can be stopped safely at any time. Schema and write queries also do not affect the database until they are committed, making it safe to terminate them as well.

Transaction close

The main way to interrupt a misbehaving query is to close the transaction.

Every transaction also opens with a default transaction timeout, which is 5 minutes. After the timeout, the server will automatically close the transaction. This provides some protection against both resource leaks (forgetting to close the transaction), and queries running for too long.

Stop a query through TypeDB clients

Currently, queries cannot be stopped from the client while execution runs on the server. (Leave us a note if this is an issue for you!)

Nothing works?

If other methods fail, you can stop or kill the server. The recovery mechanism will resolve any disruptions caused by this action, ensuring that the server restarts as a fully functional TypeDB instance with no corruption.

Is it safe to interrupt commits?

Yes. Interrupting a commit process in any way (e.g., by killing the server) is handled by the recovery mechanism. The database will remain in the correct state it was in before the commit, ensuring data integrity.