# ROLLBACK statements found on postgresql.log

**URL:** https://community.netdata.cloud/t/rollback-statements-found-on-postgresql-log/5860
**Category:** Help
**Tags:** cloud, configuration, agent, alerts, notifications
**Created:** [September 27, 2024, 7:50pm UTC](https://community.netdata.cloud/t/rollback-statements-found-on-postgresql-log/5860 "2024-09-27T19:50:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Richard\_Barrantes](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/richard_barrantes/32/3814_2.png) [@Richard\_Barrantes](https://community.netdata.cloud/u/Richard_Barrantes)
#### Post date: [September 27, 2024, 7:50pm UTC](https://community.netdata.cloud/t/rollback-statements-found-on-postgresql-log/5860/1 "2024-09-27T19:50:42Z")

</div>

Hello!

We have found several “ROLLBACK” statements in the `postgresql.log` on all nodes in the cluster.

Example:

```auto
2024-09-27 00:22:01 UTC pid=[21967][5] db=[DataBaseName] usr=[netdata] client=[localhost] app=[[unknown]] LOG: statement: ROLLBACK
2024-09-27 00:22:01 UTC pid=[21967][11] db=[DataBaseName] usr=[netdata] client=[localhost] app=[[unknown]] LOG: statement: ROLLBACK
2024-09-27 00:22:01 UTC pid=[21973][5] db=[DataBaseNameX] usr=[netdata] client=[localhost] app=[[unknown]] LOG: statement: ROLLBACK
2024-09-27 00:22:01 UTC pid=[21973][11] db=[DataBaseNameX] usr=[netdata] client=[localhost] app=[[unknown]] LOG: statement: ROLLBACK
2024-09-27 00:22:01 UTC pid=[21974][5] db=[postgres] usr=[netdata] client=[localhost] app=[[unknown]] LOG: statement: ROLLBACK
2024-09-27 00:22:01 UTC pid=[21974][11] db=[postgres] usr=[netdata] client=[localhost] app=[[unknown]] LOG: statement: ROLLBACK
2024-09-27 00:22:01 UTC pid=[21974][15] db=[postgres] usr=[netdata] client=[localhost] app=[[unknown]] LOG: statement: ROLLBACK
2024-09-27 00:22:01 UTC pid=[21967][15] db=[DataBaseName] usr=[netdata] client=[localhost] app=[[unknown]] LOG: statement: ROLLBACK
2024-09-27 00:22:01 UTC pid=[22007][5] db=[DataBaseName] usr=[netdata] client=[localhost] app=[[unknown]] LOG: statement: ROLLBACK
2024-09-27 00:22:01 UTC pid=[22007][11] db=[DataBaseName] usr=[netdata] client=[localhost] app=[[unknown]] LOG: statement: ROLLBACK

```

We have checked permissions and the overall configuration, and everything seems to be in order.

Do you know if this is expected behavior, or could it be a misconfiguration?

Thanks for your help,  
Richard Barrantes

---

<div class="post-metadata">

### Author: ![Richard\_Barrantes](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/richard_barrantes/32/3814_2.png) [@Richard\_Barrantes](https://community.netdata.cloud/u/Richard_Barrantes)
#### Post date: [November 14, 2024, 6:24pm UTC](https://community.netdata.cloud/t/rollback-statements-found-on-postgresql-log/5860/2 "2024-11-14T18:24:48Z")

</div>

This ROLLBACK statements were caused while running a query for a chart using pandas. Rollback statement occurs as the query is not closed before the next read for the chart.

This was the previous configuration:

```auto
- name: "DataBase.QueueTable"
        title: "Queue_Tables_Monitoring"
        family: "Queue_Tables_Monitoring"
        context: "Custom Alerts.Queue_Tables_Monitoring"
        type: "line"
        units: "row_count"
        df_steps: >
          pd.read_sql(""" SELECT count(*) as "DataBase.QueueTable" from "QueueTable" """, con=create_engine('postgresql://netdata@localhost/DataBase')); 

```

The issue was solved by adding “isolation\_level=“AUTOCOMMIT”” variable like this:

```auto
- name: "DataBase.QueueTable"
        title: "Queue_Tables_Monitoring"
        family: "Queue_Tables_Monitoring"
        context: "Custom Alerts.Queue_Tables_Monitoring"
        type: "line"
        units: "row_count"
        df_steps: >
          pd.read_sql(""" SELECT count(*) as "DataBase.QueueTable" from "QueueTable" """, con=create_engine('postgresql://netdata@localhost/DataBase', isolation_level="AUTOCOMMIT")); 

```

Related articles:

[https://pandas.pydata.org/docs/reference/io.html](https://pandas.pydata.org/docs/reference/io.html)  
[https://pandas.pydata.org/docs/reference/api/pandas.read\_sql.html#pandas.read\_sql](https://pandas.pydata.org/docs/reference/api/pandas.read_sql.html#pandas.read_sql)  
[https://docs.sqlalchemy.org/en/20/core/connections.html](https://docs.sqlalchemy.org/en/20/core/connections.html)  
[https://docs.sqlalchemy.org/en/20/dialects/postgresql.html](https://docs.sqlalchemy.org/en/20/dialects/postgresql.html)
