1

I am running a query with an UNLOAD statement to save the results into a CSV file,

UNLOAD
SELECT
...
FROM
...
WHERE
...
TO 'C:\\TEMP\\MyFile.csv'
    QUOTE '"';

I am getting status updates like

55% (1182880573 of estimated 2147483647 rows) complete after 01:10:00; estimated 00:57:04 remaining

and so on for 58%, 62%, etc. Does the update refer to the amount of time to write MyFile.csv, the amount of time to run the query, or both? That will help me figure out if the bottleneck is creating the file vs. running the query. The file size grew on disk over time to 539 GB, and the estimate undershot since it started giving values like,

769% (3635495259 of estimated 2147483647 rows) complete after 16:30:00

When I killed the query, it reported an execution time of 59706 seconds, so I think this retrieved a row, saved it to the file, retrieved the next row, and so on, but it would be nice to confirm.

I am using Sybase SQL Anywhere 12.

2
  • No, it will not help you figure out the bottleneck. What will help is running a query separately, and creating a junk file of a similar size separately.
    – mustaccio
    Commented Mar 24, 2020 at 21:11
  • @mustaccio Running the query without the file write is also very slow. But I am still curious: Does the query finish, then the file starts being written with the status update referring to the amount of time to write the file? Or does the query return a row of results, it gets written, then the query returns the next row, etc, so the status refers to both?
    – KAE
    Commented Mar 24, 2020 at 21:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.