oracle/python-oracledb

oracledb is about 4 times slower than dbeaver

Closed this issue · 3 comments

I test a very simple query which returns about 250k rows.

With oracledb, both thin and thick mode takes 120s. But with Dbeaver export all data to csv, it takes 36s.

Dbeaver use oracle.jdbc.OracleDriver with the same OCI as oracledb thick mode.

I'm not sure what make this big difference, maybe parallel? How can I improve my python-oracledb performance?

cjbj commented

Check the doc 'Tuning python-oracledb'. For a straight fetch operation you can tune arraysize and can tune the network SDU side.

Regarding selecting in parallel, see Selecting from an Oracle Database table in parallel using Python.

Thanks, increase arraysize to 10k significantly improve the performance!

It reduce 120s to 32s!

cjbj commented

Good to hear. I'll close this.

A general comment on benchmarking is that some query tools will fetch in batches and just dump to the screen. Comparing this with a driver doing a fetchall() isn't equivalent, since Python will have to allocate & reallocate memory to hold the whole result set.

Depending what you are doing with the data in your real app, you may also be interested in fetching to a data frame format, see Working with Data Frames.