-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate key value violates unique constraint "pk_workflow_statistics" #7256
Comments
Hey @karkill, Thanks for the report, It looks like this is already being tracked internally as |
Hi. Have you managed to fix that issue? |
Hey @mateusztylec, Not yet, at the moment this issue doesn't really break anything so the priority isn't that high. If this is breaking something for you though let me know and I can get the ticket updated. |
Hey @Joffcom, I witness the same error as above in my self-hosted environment. Additionally I see workflows that never end and therefore staying in status 'running' forever. Any chance this is related to the above issue? Is there a fix in sight? |
@Joffcom same here ... v1.16.0
|
#7824) Statistics collection about the first time a workflow loads data simply attempts an insert to db, and if it fails, we just ignore. This was causing this query to fire against production workflows multiple times, and since we want to insert only and detect whether the insertion failed, performing a select first provides gains both in terms of performance, as it's usually faster than trying an insertion as well as preventing unnecessary noise in logs. Github issue / Community forum post (link here to close automatically): https://community.n8n.io/t/duplicate-key-value-violates-unique-constraint-workflow-statistics-pkey-still-happening/29283 #7256 https://community.n8n.io/t/error-log-arriving-in-postgres/30191 #7256 https://community.n8n.io/t/cant-launch-webhooks-unable-to-find-data-of-execution/31867 --------- Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
#7824) Statistics collection about the first time a workflow loads data simply attempts an insert to db, and if it fails, we just ignore. This was causing this query to fire against production workflows multiple times, and since we want to insert only and detect whether the insertion failed, performing a select first provides gains both in terms of performance, as it's usually faster than trying an insertion as well as preventing unnecessary noise in logs. Github issue / Community forum post (link here to close automatically): https://community.n8n.io/t/duplicate-key-value-violates-unique-constraint-workflow-statistics-pkey-still-happening/29283 #7256 https://community.n8n.io/t/error-log-arriving-in-postgres/30191 #7256 https://community.n8n.io/t/cant-launch-webhooks-unable-to-find-data-of-execution/31867 --------- Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
Fix got released with |
Describe the bug
I get some error when use n8n with postgres.
I review code and I think we need to change from
insertWorkflowStatistics
toupsertWorkflowStatistics
in functionnodeFetchedData
to fix it.https://github.com/n8n-io/n8n/blob/9accf3f0d937d68ff25c3e430136cb2c6c18cf3c/packages/cli/src/services/events.service.ts#L71C1-L72C1
Change from
to
Environment (please complete the following information):
EKS v1.23.17
1.1.1
postgresdb
queue
Additional context
![image](https://private-user-images.githubusercontent.com/44264041/270566976-84b87836-5f3e-4700-b52b-9e7f4612b918.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3MDk3NjcsIm5iZiI6MTcxOTcwOTQ2NywicGF0aCI6Ii80NDI2NDA0MS8yNzA1NjY5NzYtODRiODc4MzYtNWYzZS00NzAwLWI1MmItOWU3ZjQ2MTJiOTE4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDAxMDQyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM3ZDNiYWNiMzUxNjM3MmZkMGVmYmQ3YmIyYjBmOWE3NWRlZGFjYmViMGNmNDc1MWJmMzFhMDI5N2RmNzE1NDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Bzf3N5WYTltSEMiDOAPV6W1jMlxj1lY2w11kWjWAZww)
The text was updated successfully, but these errors were encountered: