Find continuously running query in master n8n logs becuase of that n8n metric have high utilization

query is slow: SELECT ExecutionEntity.id AS ExecutionEntity_id, ExecutionEntity.data AS ExecutionEntity_data, ExecutionEntity.companyId AS ExecutionEntity_companyId, ExecutionEntity.finished AS ExecutionEntity_finished, ExecutionEntity.mode AS ExecutionEntity_mode, ExecutionEntity.retryOf AS ExecutionEntity_retryOf, ExecutionEntity.retrySuccessId AS ExecutionEntity_retrySuccessId, ExecutionEntity.startedAt AS ExecutionEntity_startedAt, ExecutionEntity.stoppedAt AS ExecutionEntity_stoppedAt, ExecutionEntity.workflowData AS ExecutionEntity_workflowData, ExecutionEntity.workflowId AS ExecutionEntity_workflowId, ExecutionEntity.waitTill AS ExecutionEntity_waitTill FROM execution_entity ExecutionEntity WHERE ExecutionEntity.workflowId IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,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?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) AND 1=1 ORDER BY id DESC LIMIT 30 – PARAMETERS: [6,7,11,12,13,14,15,16,17,18,19,20,21,27,28,29,31,32,33,34,38,40,41,42,43,44,45,51,52,53,56,57,60,61,62,67,69,70,74,77,83,86,88,94,96,97,107,114,115,122,124,126,129,142,144,146,148,149,150,152,153,154,155,156,158,159,160,161,162,163,164,165,166,167,168,169,170,171,175,176,177,179,181,182,183,186,189,190,191,192,193,194,195,196,197,198,200,201,203,207,210,216,217,218,219,222,223,224,225,226,227,228,229,232,239,241,242,243,244,248,251,252,253,256,257,259,260,261,262,263,264,265,266,267,269,272,274,275,276,278,279,280,281,282,283,284,286,287,288,290,291,294,297,298,299,300,302,304,306,309,311,312,313,314,316,317,319,321,325,327,331,333,334,335,336,338,339,340,342,343,344,348,349,350,352,353,354,355,356,357,361,364,365,367,368,369,371,372,373,374,375,376,378,379,381,384,385,386,389,390,392,393,402,403,405,406,407,409,410,411,412,413,414,419,420,422,423,424,425,429,431,432,435,436,437,440,442,443,446,447,448,449,452,453,454,455,457,458,459,461,462,463,464,465,466,467,468,469,470,474,479,480,481,482,484,485,486,488,489,490,491,493,494,495,497,499,500,501,504,505,507,510,511,512,513,515,517,518,519,520,521,522,523,525,526,527,529,530,531,533,538,539,540,541,542,543,544,545,546,547,548,550,552,553,554,555,556,557,558,560,561,562,563,564,567,568,569,571,572,573,574,575,576,577,578,579,580,581,587,589,591,592,597,599,600,601,602,603,605,606,607,609,610,612,613,615,616,617,618,619,623,625,626,627,628,629,630,631,632,634,635,636,638,639,640,642,644,645,646,647,649,650,652,653,654,660,662,663,664,666,667,669,670,671,672,673,674,675,677,678,679,680,684,686,687,688,689,690,691,692,693,694,695,696,698,700,703,706,707,710,711,713,714,716,717,718,721,722,723,724,725,726,727,729,730,731,732,735,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,753,754,755,756,759,760,762,763,764,765,766,767,768,770,771,772,773,774,775,776,777,778,779,781,782,784,785,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,814,815,816,817,819,820,821,822,823,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,843,846,847,848,849,850,851,852,853,857,858,859,860,863,864,867,868,872,873,874,875,876,877,878,880,882,883,884,885,886,887,888,889,890,892,894,895,897,898,899,900,901,902,903,904,905,906,907,908,912,913,914,920,921,922,923,924,925,926,927,928,929,930,932,933,935,937,938,940,941,943,944,947,948,951,952,953,954,955,956,957,959,965,967,972,973,974,975,976,977,979,980,981,982,983,984,985,986,987,991,992,993,994,996,1000,1001,1004,1005,1006,1007,1008,1009,1012,1013,1014,1015,1017,1021,1022,1023,1025,1026,1027,1028,1029,1030,1036,1037,1038,1039,1040,1041,1042,1044,1045,1046,1047,1048,1051,1052,1053,1054,1055,1056,1057,1058,1062,1063,1064,1065,1066,1067,1069,1071,1074,1075,1076,1077]

this query is running continuously in master n8n. Because of this utilization getting high ??

Hi @bhavish23 :wave: Welcome to the community :tada:

Out of curiosity, do you have any further logs for your instance?

Can you also share the following:

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Thanks for reply,

n8n version: [email protected]
Database (default: SQLite): Aurora mysql
n8n EXECUTIONS_PROCESS setting (default: own, main): own(queue mode)
Running n8n via (Docker, npm, n8n cloud, desktop app): (docker)
Operating system:** worker are running on fargate and n8n master is running as a Docker container over Amazon Linux 2.

@bhavish23,

0.208.0 is really old now, I would recommend upgrading. Looking at the data though I suspect you are seeing this because you have a lot of execution records in your database so possibly trimming it down will help which I would recommend you do before upgrading as well.

@Jon, we are saving execution data only of failure workflow. And I have check execution entity table it has only thousand rows. And It’s happen some times only but when happen it bring n8n master down with 502 error.

Hey @bhavish23,

In that case I would recommend starting with an upgrade.

@Jon,

which version do you recommend.

@bhavish23 Latest is always good but it will bring to the v1 release which has breaking changes so you will need to make sure you check the migration guide and have a backup in place.

Okay Thanks, one more question In our redis queue there is around 600 item(Workflow Id) is just stored there always, just wondering this is the reason of our issue ??

The query is for the main database, Looks like it is trying to load execution data and is just a bit slow, I guess if the redis data is old you could clear it and see if it helps but I know we made a lot of changes to our database queries recently and even moved the execution data to it’s own table to make things quicker.

okay @Jon , Thanks for your quick response

1 Like