# Non stoping incremental query

**URL:** <https://discourse.getdbt.com/t/non-stoping-incremental-query/12556>\
**Category:** Help\
**Tags:** incremental\
**Created:** [March 21, 2024, 11:41am UTC](https://discourse.getdbt.com/t/non-stoping-incremental-query/12556 "2024-03-21T11:41:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Psauvage](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@Psauvage](https://discourse.getdbt.com/u/Psauvage)\
**Post date:** [March 21, 2024, 11:41am UTC](https://discourse.getdbt.com/t/non-stoping-incremental-query/12556/1 "2024-03-21T11:41:38Z")

</div>

I am fairly new to dbt

I have a dbt model that query a staging table (where the incremental works).  
When I run the model without incremental it takes only a few seconds to finish and query 90K rows.  
When I add the incremental part ( I added it below) it never stop running (more than 10 minutes ) as it is looking for the newest rows in the staging table.

The staging table comes from a partitionned external table from GCS.

```auto
{{
    config(
        materialized='incremental'
    )
}}

```

```auto
WITH parsed_json AS (
    SELECT
        payload as json_data,
        `date`
    FROM {{ ref("stg_table") }}
),
incremental_load AS (
    SELECT
        p.json_data,
        p.`date`
    FROM parsed_json p
    {% if is_incremental() %}
        WHERE p.`date` > (SELECT MAX(`date`) FROM {{ this }})
    {% endif %}
)

--SELECT QUERIES FROM incremental_load 

```

Have you ever had this issue ?  
Thanks in advance !
