-
Notifications
You must be signed in to change notification settings - Fork 33
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 #76
Comments
Running the same command, in exactly the same conditions resulted in a success just now. |
What is the version of pg_squeeze and PostgreSQL server? |
I am running pg_squeeze 1.7 with postgreSQL 16. |
Can you please share the server log around the moment the squeezing failed? |
For sure!
|
One thing I don't understand is that that the error message is about index And in general, do you know if any DDL/DML statements were running during the squeezing? ( |
Here's the complete description:
Nothing apart from EDIT: After double checking, no updates were occuring, but inserts were going on. |
Right now I have no idea how this error could occur. Perhaps I need to add a partitioned table to my tests, in case the problem is related to partitioning. Please let me know if you think you are able to reproduce the problem. |
I am not sure if this will help but this issue occurred during significant table activity, with approximately 30-40k rows being inserted/deleted per second while the squeeze operation was performed. This is the first occurrence of this issue, despite using pg_squeeze daily on this table for several weeks under similar workload conditions. Looks ugly to debug, eh. |
The extension should handle the concurrent changes regardless the rate. I'll consider adjusting the extension so it provides more information if thing like this happens. (In fact it's not clear whether the error i caused by pg_squeeze or by the PostgreSQL logical decoding subsystem.) |
One more note. The log you shared by mistake (you eventually removed it from the issue description but I still have the notification in email) contained lines like
If the pg_squeeze error occurs again, please check if such warnings are also around. I wonder if the issue is somehow related. (It should not unless there's a bug either in pg_squeeze or in PostgreSQL core, however bugs just happen to exist.) Of course I recommend you to resolve the freezing problem, otherwise you can end up being unable to connect to the database until VACUUM FREEZE is performed (possibly hours. |
These were older, unrelated logs caused by long-held transactions due to a bug in the software that was accessing the database. In this particular case, I don't think this is related to the current issue. When performing the squeeze, I didn't observe these logs (nor any similar logs for hours before and after), as the original issue had been fixed a few days prior to the squeeze operation. |
Hi,
I launched pg_squeeze against one of my table using:
SELECT squeeze.squeeze_table('public', 'data');
Squeezing failed with message:
ERROR: duplicate key value violates unique constraint "ind_2"
Schema:
The text was updated successfully, but these errors were encountered: