Sitemap

MySQL: 1062 Duplicate entry ‘’ for key ‘group_key’

1 min readNov 14, 2019

--

Press enter or click to view image in full size
Source: https://unsplash.com/photos/fPkvU7RDmCo

This is just another note to self for the future.

Today one of our data intensive apps faced a very weird error on one of the joins in production. Those type of “It was working, now it doesn’t”. No one had touched the system and no fresh deployments had been made.

It gets to a point in your life where something that was working just decides not to anymore and for no reason. Today was that day and it this 1062 Duplicate entry for ‘group_key’.

It seems to be a well known MySQL bug that you only face when you hit some threshold in data storage and manipulation. Here is the bug documentation:

https://bugs.mysql.com/bug.php?id=58081

Get Leonard’s stories in your inbox

Join Medium for free to get updates from this writer.

Solution?

  1. Increase your max_heap_table_size

SET SESSION max_heap_table_size=536870912;

2. Increase your tmp_table_size

SET SESSION tmp_table_size=536870912;

For us, that still didn’t solve the problem and we had to:

Increase /tmp size.

How? mount -o remount,size=5G /tmp/

Back to <code>

--

--