On 2024-09-21 20:55:13 +0530, Lok P wrote: > On Sat, Sep 21, 2024 at 8:07 PM Peter J. Holzer <hjp-pgsql@xxxxxx> wrote: [... lots of code elided. method2 used 1 insert per row, method3 1 insert for 50 rows ...] > On my laptop, method2 is about twice as fast as method3. But if I > connect to a database on the other side of the city, method2 is now more > than 16 times faster than method3 . Simply because the delay in > communication is now large compared to the time it takes to insert those > rows. > > > > Thank you so much. > I was expecting method-3(batch insert) to be the fastest or atleast as you said > perform with similar speed as method-2 (row by row insert with batch commit) Oops, sorry! I wrote that the wrong way around. Method 3 is the fastest. I guess I meant to write "method2 takes about twice as long as method3" or something like that. hp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@xxxxxx | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
Attachment:
signature.asc
Description: PGP signature