---
title: "Execute query"
slug: "execute-query"
updated: 2025-10-08T10:04:51Z
published: 2025-10-08T10:04:51Z
canonical: "docs.akridata.ai/execute-query"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.akridata.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Execute query

Editing an image query based on specific requirements can be crucial when finding images relevant to your dataset.

To familiarize yourself with the various catalog options and controls, refer to the [Catalog](/data-explorer/docs/catalog-introduction) article.

To open the **Edit Query** window, on the catalog page, click the highlighted button that displays the current view/table in context. In the example image below, **all_pipelines_tables** is the view that is currently in context.

![](https://cdn.document360.io/3e9d4528-fbc6-4948-a804-8ee7068e7ac3/Images/Documentation/execute-query.jpg)

The **Edit Query** window opens.

## Query editor

![](https://cdn.document360.io/3e9d4528-fbc6-4948-a804-8ee7068e7ac3/Images/Documentation/image(32).png)

The default query condition will fetch all the frames from the table/view that is in context.

The Query editor has two primary options: **Conditions(for basic conditions)** and **Advanced**. The **Max frame** limits the number of frames fetched by the query.

### Conditions

**Add Conditions:** Click this option to expand the panel and add query conditions, as shown below.

![](https://cdn.document360.io/3e9d4528-fbc6-4948-a804-8ee7068e7ac3/Images/Documentation/Screenshot from 2024-09-20 11-32-23.png)

1. Specify the query conditions by selecting the relevant options from the **Column** and **Operation** drop-down menus.
2. Fill in the **Values**field as appropriate for the condition; for example, the above screenshot shows a condition to fetch frames with dinop1_0_file_id column value greater than 100.
  1. In case the column is of JSON type, you can specify the inner field value by specifying it after $. (for example, **$.x_top**), and specify the condition and value to be searched for. ![](https://cdn.document360.io/3e9d4528-fbc6-4948-a804-8ee7068e7ac3/Images/Documentation/json-search.jpg)
  2. In case you had selected the subdirectory to view the images, upon clicking **'Add Conditions'** for the 'file_path' column, the **'Values'** field is auto-populated with the complete path of the subdirectory. ![](https://cdn.document360.io/3e9d4528-fbc6-4948-a804-8ee7068e7ac3/Images/Documentation/edit-query-subdir-full-filepath.jpg)
3. Click the **+** (plus) button to combine multiple conditions, as needed, using OR and AND as the operators.

### **Add Custom****Conditions**

If the query condition to be specified is not present as an operation in the drop-down, you can specify a custom SQL WHERE condition.

1. Click the down arrow beside the **Add Conditions** option, and click **Add Custom Condition**. ![](https://cdn.document360.io/3e9d4528-fbc6-4948-a804-8ee7068e7ac3/Images/Documentation/add-custom-condition.jpg)

The **Custom Condition** field appears with an **And** condition by default.
2. Enter the required SQL WHERE condition (as shown in the example below).

![](https://cdn.document360.io/3e9d4528-fbc6-4948-a804-8ee7068e7ac3/Images/Documentation/custom-condition.png)You can add a custom condition independently or along with the existing conditions.

**Order by:**No order is applied to the output results by default. You can specify the ordering as required.

1. Click the down arrow next to the **"Add Conditions"** option, and then click **"Order By**."
2. Select the required option from the Order By drop-down menu
3. Select **Sort Order** as **Ascending** or **Descending**, as needed. ![](https://cdn.document360.io/3e9d4528-fbc6-4948-a804-8ee7068e7ac3/Images/Documentation/orderby.png)

**Max frame limit**: Once you have specified the conditions, you can use the **Max frames** option to select the maximum number of frames whose rows should be returned. This limit is capped to the number of frames defined in the plan limits corresponding to the currently active subscription plan.

### Advanced conditions

![](https://cdn.document360.io/3e9d4528-fbc6-4948-a804-8ee7068e7ac3/Images/Documentation/Screenshot from 2024-09-20 11-39-54.png)

- **Add Post Conditions:**When an image has multiple rows of attributes, the default behavior on pipeline tables and views is to return all the rows corresponding to that image. For example, an image with two bounding boxes with the categories 'person' and 'car' in two rows will return both rows even if a filter condition 'category = person' matches only one row. This default behavior can be overridden using post conditions, where an additional filter is applied to the rows of an image according to the specified post conditions. With 'category=person' specified as a post condition, only the row with the 'person' bounding box will be returned.
- **Select Resultset:**Use this option to select one or more resultsets in which the query result is restricted to the frames in the selected [resultset](/data-explorer/docs/resultsets). This can be used to create a visualization job on frames belonging to one or more resultsets.![](https://cdn.document360.io/3e9d4528-fbc6-4948-a804-8ee7068e7ac3/Images/Documentation/edit-query-resultset-selection.jpg)
- **Sequence query:**For video datasets, the catalog query can be specified to return a representative frame from a sequence of frames. This result can be used to create a 'Sequence Explore' job where sequences are visualized and searched instead of individual images. The 'Sequence query' has the following additional parameters.
  1. **Length:** Length of the sequence in seconds.
  2. **Stride:** Gap between successive sequences. The frames in the catalog are divided into chunks, each covering 'Stride' seconds, and only one frame matching the query conditions is chosen from a stride.
  3. **Offset:** Consider an event with frame X with 'category=person' ground truth. However, the sequence of interest is a 'traffic light turning green while a person is about to walk into a crosswalk. This event starts a few seconds before the frame that has 'traffic_light=green'. To support this use case, the offset specifies the number of seconds before the frame that matches the query conditions from where the sequence should be considered to start.
- **Enable coreset**: A coreset is a sampled set of images that has a content-based representation for the entire dataset. Use this option to specify the **Fraction** (in percentage) or the **Count** of coreset points against which the query must be executed. The sampling fraction should be between 0.01 and 1.

### Run the query

- To run the query according to the selected conditions, click the **Query** button.
- To initiate a [Global search](/data-explorer/docs/global-search) for the query output, click the drop-down arrow beside the **Query** option and select **Query(Global Search)**. ![](https://cdn.document360.io/3e9d4528-fbc6-4948-a804-8ee7068e7ac3/Images/Documentation/query-global-search.jpg)
