# Query History

The query history section contains a log of all the queries run in the query editor. The logs are displayed in a table to get an overview of all past queries, their status, and other metadata for troubleshooting or auditing.

## Viewing Query History

1. Click **Query History** in the navigation panel.&#x20;
2. Choose the cluster you want to view the query history for. Without selecting a cluster, the query history will not be displayed.
3. The query history will be displayed.
4. Click any query ID to see more details about the query.
   * Select the 'Execution Plan' tab to view how the query was run.
5. Click the Refresh icon to view the latest results.

<figure><img src="https://3484040590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeVBYKZm1xFKFFVzS0lRJ%2Fuploads%2FdGXHH80yLOy01gouJUZI%2FScreenshot%202024-12-10%20at%202.51.18%E2%80%AFPM.png?alt=media&#x26;token=0ace7d22-abbd-4722-8dc6-03dc9c905bd9" alt=""><figcaption><p>Query History</p></figcaption></figure>

<figure><img src="https://3484040590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeVBYKZm1xFKFFVzS0lRJ%2Fuploads%2F2dQkYbg5ivfPtypRkaIT%2Fexecution_plan.png?alt=media&#x26;token=eefbcfac-c829-41d9-b84a-882c2660acde" alt=""><figcaption><p>Viewing a query</p></figcaption></figure>

<figure><img src="https://3484040590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeVBYKZm1xFKFFVzS0lRJ%2Fuploads%2FUcheQumz1i8aBAt7622T%2Fquery_execution_plan.png?alt=media&#x26;token=af1600e0-8b7a-4ff8-a31b-91805b77b6f2" alt=""><figcaption><p>Viewing query execution plan</p></figcaption></figure>

## Filtering Query History

1. Click on 'Select entity type' to find multiple filtering options.
2. Select the entity type.
3. Type in the entity name in the space provided and then click on **Add Filter** to add that filter.
   * Enter the starting characters of the name to search for.
4. You can remove the filter one at a time by clicking the x icon or remove all the filters by clicking on **Clear Filters.**
5. Click 'Last 5 mins' to set a date range to filter results by.

## Customizing Query History View

To show/hide columns and change the page size, click the Settings (wheel) icon and select the required page size and columns from the dropdown list.

* The number of rows displayed on the Query History dashboard can be customized according to each user's preference by selecting the desired page size.
* Users can customize the visibility of columns in the Query History dashboard based on their requirements. Please note that the query ID cannot be hidden by default.

{% hint style="info" %}
The chosen page size and column preferences will be automatically saved in the user's account for future reference.
{% endhint %}

<figure><img src="https://3484040590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeVBYKZm1xFKFFVzS0lRJ%2Fuploads%2Fgb8klkATT4BtQbrTIdqd%2FScreenshot%202024-03-14%20at%208.17.55%20PM.png?alt=media&#x26;token=681ab8e3-2cac-46dd-83ce-ad5cb7a020a1" alt=""><figcaption><p>Prefrences</p></figcaption></figure>

## Export Query History

Click the **Export CSV** button to download a CSV file containing the filtered results. All times in the CSV will use the UTC timezone. You can also customize the query history CSV based on column selection and export data for the selected columns only.&#x20;

<figure><img src="https://3484040590-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeVBYKZm1xFKFFVzS0lRJ%2Fuploads%2F7YJoipMULIBxdzOwBUEb%2FScreenshot%202024-03-16%20at%203.18.26%20PM.png?alt=media&#x26;token=d43c736c-2fa7-46ca-8756-06765fd39d30" alt=""><figcaption><p>Column filter</p></figcaption></figure>

## Query Information

The following information is available in the Query History:

<table><thead><tr><th width="209">Column</th><th>Description</th></tr></thead><tbody><tr><td>Query ID</td><td>A unique Query ID of each query that isexecuted. </td></tr><tr><td>Query hash</td><td>A unique identity for similar queries.</td></tr><tr><td>Cached Result</td><td>The cached result indicates "yes" if the query retrieved results from the cache and "no" otherwise.</td></tr><tr><td>Status</td><td><ul><li>The status of the query.</li><li><p>There are five possible statuses:</p><ul><li><mark style="color:green;">SUCCESS</mark></li><li><mark style="color:red;">FAILED</mark></li><li>RUNNING</li><li>TIMEOUT</li><li>PARSING FAILED</li><li>CANCELLED</li></ul></li></ul></td></tr><tr><td>Planning time (sec)</td><td>The amount of time taken by the engine to create a plan for the query.</td></tr><tr><td>Queuing time (sec)</td><td>The amount of time the query was queued and waited to be run by the engine.</td></tr><tr><td>Execution time (sec)</td><td>The amount of time taken to run the query.</td></tr><tr><td>Client percieved time (sec)</td><td>The amount of time elapsed from the initiation of a query by the user to the presentation of results or feedback within the user interface.</td></tr><tr><td>Start time</td><td>The time the query started running, i.e. started query planning. Displayed in the browser time zone.</td></tr><tr><td>End time</td><td>The time the query completed running, i.e. results were provided. Displayed in the browser time zone.</td></tr><tr><td>Cluster</td><td>The name of the cluster used to run the query.</td></tr><tr><td>Run by</td><td>The username of the user who ran the query.</td></tr></tbody></table>

{% embed url="<https://www.loom.com/share/fcb1489bbf7b4717a47fbd4f51a6f94b?sid=0c2574ed-4d20-4cb7-a8a5-648f92d8e659>" %}
Query History Walkthrough
{% endembed %}
