Etyr
Contributor II

Yes I was using fetchall()

Here is what I get when I use fetchmany(100000) (not 10.000, but 100.000) else there was too much printing:

<databricks.sql.client.Cursor object at 0x7fddfd233be0>
Fetching chunk of size 100000, 1
1.2840301990509033
Fetching chunk of size 100000, 2
1.7594795227050781
Fetching chunk of size 100000, 3
1.4387767314910889
Fetching chunk of size 100000, 4
1.9465265274047852
Fetching chunk of size 100000, 5
1.284682273864746
Fetching chunk of size 100000, 6
1.8754642009735107
Fetching chunk of size 100000, 7

So it takes around 1.5-2 secondes per chunk of size 100.000. From what I understand in the documentation, the chunk size is the number of rows fetched.

Since I have 1008342364 rows, it will take me 10084 fetchmany(100000)

10084 * 1.5 (seconds per fetchmany) = 15125 total seconds to get all the data. so approx 4 hours.

If a do a fetchmany(1000000), i get one fetch of 14 seconds.

1008342364 rows / 1000000 = 1009 fetches

10084 * 14 = 14126 secondes for all fetchs => 3.9 hours