Skip to content

Unable to apply Django migration in Postgres DB

In Django app, I’m using Postgres DB. I have two tables where one of them has 76 million records and the other 8.2 million.

I have created a new migration file where in I’m adding a new column to a table in an app and setting default value to 0.

My database is hosted on Ubuntu EC2 instance which has RAM of 8 GB.

When I try to apply the migration using python migrate app_name migration_file_name, it’s throwing below error:

File “/usr/local/lib/python2.7/site-packages/django/db/backends/”, line 64, in execute return self.cursor.execute(sql, params) django.db.utils.OperationalError: SSL SYSCALL error: EOF detected

I have gone through this solution Postgres SSL SYSCALL error: EOF detected with python and psycopg But not sure if it’s memory issue or something else.

Python: 2.7.12
Django 1.11.15
Ubuntu: 18.04
Postgres DB: 10.7

What else could be the issue?



Your query might too large – too many operations. This causes the system to run out of memory.

7 People found this is helpful