This is a FastAPI project using SQLAlchemy and an AWS RDS postgres database. The waits (AAS) on database suddenly increase above 2 (for a 2 vCPU - t4g.small instance), and when checking on Performace Insights, I see a large load on the CPU from the sql instruction MOVE ALL IN "query-cursor_1", with an average latency above 200 seconds. This is happening a couple of times a day, for about five minutes each time. During these periods, database connections don't increase, and the increase in database load is not outside of the normal range.
Waits during suddently CPU load increment
CPU utilization and DB connections
I'm not executing the MOVE ALL IN "query-cursor_1" instruction, and I have not been able to determine where this instruction comes from.
I'm not using cursors, so I find the execution of this instruction very strange. I do not have a clear understanding of the use of cursors, but I know that their use can lead to performance problems and table blocking. However, as I mentioned above, I am not directly executing any cursor-related instructions.
I have been changing some indexes to improve large data queries performance, but my database is relatively small with 30 tables and max half million rows in a couple of tables.
I did not find references about this query for RDS postgres databases, neither references from SQLAlchemy related to that.
I appreciate your help!
rdsadmin
, which appears to be controlled by AWS. – Octangular