# Can QuestDB automatically track/timestamp when an existing row is modified

**URL:** <https://community.questdb.com/t/can-questdb-automatically-track-timestamp-when-an-existing-row-is-modified/166>\
**Category:** Community\
**Tags:** question\
**Created:** [September 6, 2024, 10:28pm UTC](https://community.questdb.com/t/can-questdb-automatically-track-timestamp-when-an-existing-row-is-modified/166 "2024-09-06T22:28:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lars\_m](https://avatars.discourse-cdn.com/v4/letter/l/e47c2d/32.png) [@Lars\_m](https://community.questdb.com/u/Lars_m)\
**Post date:** [September 6, 2024, 10:28pm UTC](https://community.questdb.com/t/can-questdb-automatically-track-timestamp-when-an-existing-row-is-modified/166/1 "2024-09-06T22:28:21Z")

</div>

I would like to track when an existing row is updated with a new column value.

For example, table:

```auto
CREATE TABLE mytable (
	ts_event TIMESTAMP,
	v_1 LONG,
	v_2 INT,
	ts_created TIMESTAMP,
	ts_modified TIMESTAMP
	)
		timestamp(ts_event)
  PARTITION BY WEEK
  DEDUP UPSERT KEYS(ts_event);

```

contains row:

```auto
ts_event | v_1 | v_2 | ts_created | ts_modified
2022-01-01T12:00:00Z | 3 | 15 | 2023-02-01T08:00:00Z | NULL

```

Can I configure the table so that if an existing ‘ts\_event’ row is updated with any new values, QuestDB automatically fills in the ‘ts\_modified’ column with the now() timestamp (e.g.: 2024-03-02T09:00:00Z), like so:

```auto
ts_event | v_1 | v_2 | ts_created | ts_modified
2022-01-01T12:00:00Z | 4 | 15 | 2023-02-01T08:00:00Z | 2024-03-02T09:00:00Z

```

Note, do not update the ‘ts\_modified’ column if the row is unchanged.  
I am using the Python ingress client, e.g.: questdb.Sender() dataframe() method to ingest data into the table.

Thanks in advance,  
-Lars

---

<div class="post-metadata">

**Author:** ![nwoolmer](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.questdb.com/nwoolmer/32/24_2.png) [@nwoolmer](https://community.questdb.com/u/nwoolmer)\
**Post date:** [September 12, 2024, 1:23pm UTC](https://community.questdb.com/t/can-questdb-automatically-track-timestamp-when-an-existing-row-is-modified/166/2 "2024-09-12T13:23:32Z")

</div>

Hi @Lars_m ,

This is not possible in the way you’d like. You would need to use the updated timestamp as the designated timestamp, and use the `ServerTimestamp` feature in the Python client to generate this field.

This will make queries less efficient since the table will be clustered by a different timestamp to your current one.

However, work is in progress to bring materialised views. It may be that auditing columns and/or feedback on row updates could be part of a future iteration of this.

So in summary - you’d need to manage this on the application side for now.

---

<div class="post-metadata">

**Author:** ![Lars\_m](https://avatars.discourse-cdn.com/v4/letter/l/e47c2d/32.png) [@Lars\_m](https://community.questdb.com/u/Lars_m)\
**Post date:** [September 13, 2024, 6:15pm UTC](https://community.questdb.com/t/can-questdb-automatically-track-timestamp-when-an-existing-row-is-modified/166/3 "2024-09-13T18:15:46Z")

</div>

Thanks @nwoolmer for the reply & feedback. Per the docs it looks like `ServerTimestamp` is on its way to being deprecated, so I’ll avoid that route.  
I assumed I’d probably need to implement this on the application side, but though I would ask just in case Qdb has (or road-mapped) the ability to handle logic like this in the db engine.
