# Sql\_last\_value is updated only once

**URL:** <https://discuss.elastic.co/t/sql-last-value-is-updated-only-once/383194>\
**Category:** Logstash\
**Created:** [November 4, 2025, 8:40am UTC](https://discuss.elastic.co/t/sql-last-value-is-updated-only-once/383194 "2025-11-04T08:40:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chiel](https://avatars.discourse-cdn.com/v4/letter/c/41988e/32.png) [@chiel](https://discuss.elastic.co/u/chiel)\
**Post date:** [November 4, 2025, 8:40am UTC](https://discuss.elastic.co/t/sql-last-value-is-updated-only-once/383194/1 "2025-11-04T08:40:29Z")

</div>

Hi,

I’m using sql\_last\_value, last\_run\_metadata\_path, tracking\_column etc. for tracking the most recent value of a given column of my query. When I restart logstash, the value is updated correct in the tracking file (last\_run\_metadata\_path). But when new records are found in the next run, the tracking file is updated, but the tracking column itself is not…. As a result, I get multiple records ingested.

Configuration:

jdbc\_paging\_enabled =\> true  
lowercase\_column\_names =\> false  
clean\_run =\> false  
use\_column\_value =\> true  
tracking\_column =\> "instant"  
tracking\_column\_type =\> "timestamp"

query (partly):

statement =\> "  
SELECT  
…  
instant = e.[Instant],  
…  
FROM e  
WHERE instant \> :sql\_last\_value  
ORDER BY instant ASC  
OFFSET 0 ROWS  
FETCH NEXT 10000 ROWS ONLY  
"

Does anybody know whats going wrong?

rgds, Chiel
