Forums

Large MySQL Queries

Hello,

I have a database with a table consisting of more than 4 Million rows. If I want to query them just as one file, it works, but if I create a more complicated SQL-statement (e.g. with group by), the connection is lost after 30 seconds and the query isn't finished. I get "Error Code: 2013. Lost connection to MySQL server during query".

I tried to do queries via MySQL Workbench and a python code from my laptop, they don't work even though the same query in the console on PythonAnywhere does.

Is it possible to set a higher timeout value or is there a workaround I can run my queries?

Thanks for the help!

If it's working on PythonAnywhere, then it's not a timeout on PythonAnywhere. Perhaps there's a timeout in workbench that you can change. You could also use explain (https://dev.mysql.com/doc/refman/5.6/en/using-explain.html) to work out how you can optimise your query.

Thanks for the link! I found the setting, I had to change, it works now

:-)