1 year ago
#384013
Alan Kohler
Psycopg2 Python too slow to retrieve data from Dbeaver in Ubuntu. No idea why
I hope that someone can help me, I have a weird issue by trying to retrieve data with python that resides into AWS RDS EC2 instance behind a bastion host that I connected locally in Dbeaver on my ubuntu LTS 20.04
I'm using a very standard code that yesterday was working without any issue in performance
import psycopg2
con = psycopg2.connect(user=myuser,
password=mypassword,
host='localhost',
port=5433,
database=mydwh)
sql = """select * from table limit 100"""
data = pd.read_sql(sql, con)
today I can retrieve super fast 100 rows, so I know that the connection works fine, but if I want to retrieve the whole table i.e. around 1M rows it seems to be completely stuck and not to work, even after 1 hour. The same query (without limit) in dbeaver takes around 15seconds to compute.
I already tried to change the port from 5434 to 5433 and changing localhost to 127.0.0.1, because I read somewhere that could be an issue, but nothing changed. The port 5432 is already in use.
Do you have any idea why it is suddenly so slow? Yesterday the same operation was lasting max 30sec. Any help would be really appreciated, because I really have no clue about what happened
python
postgresql
ubuntu
psycopg2
dbeaver
0 Answers
Your Answer