I'm writing a script for exporting some data.
Some details about the environment:
- The project is Django based
- I'm using raw/custom SQL for the export
- The database engine is MySQL.
- The database and code are on the same box.-
Details about the SQL:
- A bunch of inner joins
- A bunch of columns selected, some with a basic multiplication calculation.
- The sql result has about 55K rows
When I run the SQL statement in the mysql command line, it takes 3-4 seconds
When I run the SQL in my python script the line cursor.execute(sql, [id]) takes over 60 seconds.
Any ideas on what might be causing this?