Sudden Spike in Database Request

Hey everyone,
I love N8N so far; as a newbie when it comes to databases and development, I am happy for this awesome solution.

Situation
I am, at best, an intermediate coder. Right now we are building an MVP, before handing things over to someone who knows what he is doing :wink:

Problem
Today I logged into my dashboard and recognized a massive spike in my Egress. Further analytics point me to the queue you can see which seems to consume a lot of time.

Can I somehow find out what was responsible for this? I use Google Data Studio + N8N at the moment. Those are the only two who could have caused it. But without more information I am a bit lost where to look.

I don’t understand why a simple queue like the one here is responsible for such tremendous database usage.

Screenshot 2024-08-23 at 10 45 26

Screenshot 2024-08-23 at 10 46 46

Ok, further analytics show me, that my self-hosted N8N instance is the root of the evil.

Screenshot 2024-08-23 at 11 08 50

But I still don’t understand why 51,940 calls happen. Hm. Unfortunately I deleted all my executions yesterday, because I wanted to start clean.

Any ideas how something like this can happen?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
{
  "meta": {
    "instanceId": "33c794b9ddc275e23384ba7b1bd2ad189cf7dee858c2fffa13c7e0c6412c7d7f"
  },
  "nodes": [
    {
      "parameters": {
        "operation": "select",
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "user",
          "mode": "list",
          "cachedResultName": "user"
        },
        "returnAll": true,
        "where": {
          "values": [
            {
              "column": "active",
              "value": "={{ true }}"
            }
          ]
        },
        "options": {}
      },
      "id": "92ef2ddf-e392-4f34-8f99-e1fdff1d26f8",
      "name": "Get Active Users",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.5,
      "position": [
        1380,
        280
      ],
      "credentials": {
        "postgres": {
          "id": "nv2KoW1YuQyTg7rc",
          "name": "Postgres account"
        }
      }
    }
  ],
  "connections": {},
  "pinData": {}
}```

This is at simple as it could be...

I found the error. My postges didn’t do a COUNT but a SELECT.

The select returned 100 contacts … always for every run. So, every run created a lot of database queries.

SELECT COUNT(*) 
FROM public.contacts 
WHERE account_id = '{{ $('Execute Workflow Trigger').item.json.uni_account_id }}';

Solved the problem :wink:

3 Likes

That is my sort of issue, Nice work on tracking it down.

1 Like

Thanks @Jon I am quite happy that I could trace it down :slight_smile:

Also bonus points for posting your own solution! :clap: Many people forget to do that.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.