We are having issues with our hosted n8n, we had to upgrade our database (AWS RDS db.r5.12xlarge $12/hour) in order to support something that the n8n does every 30 minutes, as shown in the graph, otherwise the CPU goes to 100% and jobs became stalled. We are running a deployment with 2 worker nodes and 1 main node. The issues is not on the workers/main, it’s the database.
SELECT "ExecutionEntity"."id" AS "ExecutionEntity_id", "ExecutionEntity"."finished" AS "ExecutionEntity_finished", "ExecutionEntity"."mode" AS "ExecutionEntity_mode", "ExecutionEntity"."retryOf" AS "ExecutionEntity_retryOf", "ExecutionEntity"."retrySuccessId" AS "ExecutionEntity_retrySuccessId", "ExecutionEntity"."status" AS "ExecutionEntity_status", "ExecutionEntity"."startedAt" AS "ExecutionEntity_startedAt", "ExecutionEntity"."stoppedAt" AS "ExecutionEntity_stoppedAt", "ExecutionEntity"."work
SELECT DISTINCT "distinctAlias"."ExecutionEntity_id" AS "ids_ExecutionEntity_id" FROM (SELECT "ExecutionEntity"."id" AS "ExecutionEntity_id", "ExecutionEntity"."finished" AS "ExecutionEntity_finished", "ExecutionEntity"."mode" AS "ExecutionEntity_mode", "ExecutionEntity"."retryOf" AS "ExecutionEntity_retryOf", "ExecutionEntity"."retrySuccessId" AS "ExecutionEntity_retrySuccessId", "ExecutionEntity"."status" AS "ExecutionEntity_status", "ExecutionEntity"."startedAt" AS "ExecutionEntity_startedAt"
this seems to be cut off , but might be renaming columns in a table ?
SELECT DISTINCT "distinctAlias"."ExecutionEntity_id" AS "ids_ExecutionEntity_id" FROM (SELECT "ExecutionEntity"."id" AS "ExecutionEntity_id", "ExecutionEntity"."finished" AS "ExecutionEntity_finished", "ExecutionEntity"."mode" AS "ExecutionEntity_mode", "ExecutionEntity"."retryOf" AS "ExecutionEntity_retryOf", "ExecutionEntity"."retrySuccessId" AS "ExecutionEntity_retrySuccessId", "ExecutionEntity"."status" AS "ExecutionEntity_status", "ExecutionEntity"."startedAt" AS "ExecutionEntity_startedAt"
Essentially, the query is creating a set of unique IDs from the ExecutionEntity table while also gathering other related information within a subquery, which might be used for further manipulations or conditions in the full query. The renaming using the AS keyword helps in perhaps better formatting or clearer identification of the data in the output.