python mysql.connector fetchall() run extremely slow
<p>I have a simple sql query using python and mysql.connector</p>

<pre><code>query = 'SELECT age, score FROM patient'
cursor.execute(query)
dr = cursor.fetchall() or cursor.fetchone()
print(dr)
</code></pre>

<p>In phpmyadmin, this query is very fast (0.003s).
It also runs fast in Python if I use fecthone(). However, it becomes extremely slow if I use fetchall(). Sometimes it take a few minutes and prints result. Sometimes it simply failed and halt.</p>

<p>My data is about 440,000 lines. I want to actually plot score against age, so I have to read all data out. Someone can help me?</p>

<p>ps: if I get rid of fetchall(), fetchone() and print, it runs very fast. But then how do get my data and plot it?</p>