When are trying to retrieve around 10,000 records the script times out.
After reducing the records to 6,000 the script runs successfully.
Studio 11.x.x & 12.x.x
Increased the data chunks setting in Studio to 20,000
This setting can help performance when you are downloading a large number of records. By default, for single-table queries, Studio Query calculates the optimum chunk value for the run based on query characteristics, such as total field length and number of records to download.
When you specify a data chunk value, Studio Query fetches only the number of records for each chunk. The maximum allowed value for chunk size is 450000 (225000 from 12.0). A Stop button also appears so that you can stop the download if it is running for too long.
Note: The Data Chunk setting is not available for InfoSets and SAP queries.