2019-01-15

fast csv export

https://blogs.oracle.com/opal/fast-generation-of-csv-and-json-from-oracle-database


sqlplus -s -m 'csv on' cj@localhost/pdb1 @t.sql
(Pro tip: the -s silent option may hide the password prompt on some platforms making SQL*Plus appear to hang! Enter the password and all will be well.)
CSV mode bypasses the traditional SQL*Plus pagination routines, making output faster to generate. And using the -m 'csv on' option additionally invokes a faster I/O subsystem, and also automatically sets some SET options to the values of another new option sqlplus -f. Two of the changes are increasing SET ARRAYSIZE to 100 and SET ROWPRETCH to 2.
Increasing SET ARRAYSIZE allows larger amounts of data to be returned in each low level request to the database, thus improving overall efficiency. Having SET ROWPRETCH to 2 reduces the database 'round trips' required between SQL*Plus and the database for queries that return only single rows. You should adjust the values of these, and other, settings to suit your data size and performance goals.
CSV mode can be used when connecting SQL*Plus 12.2 to Oracle Database 12.2 or earlier.

Niciun comentariu:

Trimiteți un comentariu