Terminating sessions

This document describes how session termination works in BigQuery.It is intended for users who already have a general understanding ofBigQuerysessions.

Before you complete these steps, ensure you have the necessarypermissions toterminate a session.

Terminating a session

A session can be terminated manually or automatically.The history of a terminated session is available for 20 days after termination.

Auto-terminate a session

Asession is terminatedautomatically after 24 hours of inactivity or after 7 days, whichever happensfirst.

Terminate the current session

You can terminate your current session with a SQL statement or in theGoogle Cloud console, if the session was created there.

Console

  1. In the Google Cloud console, go to the BigQuery page.

    Go to BigQuery

  2. Find the editor tab that contains your session and close it. The session is terminated.

SQL

Do the following to terminate your session:

  1. In the Google Cloud console, go to theBigQuery page.

    Go to BigQuery

  2. In the query editor, enter the following statement:

    CALLBQ.ABORT_SESSION();

  3. ClickRun.

For more information about how to run queries, seeRun an interactive query.

Terminate a session by ID

You can terminate a session using its ID. You do not need to bein the session to terminate it this way.

Get the session ID, and then run the following statement:

CALLBQ.ABORT_SESSION(SESSION_ID);

ReplaceSESSION_ID with the ID of the session to terminate.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-02 UTC.