[Mono-list] Batch inserts with ADO.NET

Fredrik Hedberg fredrik.hedberg@hedbergs.com
Sat, 22 May 2004 13:28:49 +0200


What I would like to do in ADO.NET (any provider, spec DB2) is what we
would do with executeBatch in JDBC, for example

PreparedStatement statement = connection.prepareStatement("INSERT
INTO....");
                        
            for (int i = 0; i < 1000; i++)
            {
                    statement.setInt(1,rand.nextInt());
                    statement.addBatch();
            }
            statement.executeBatch();

But, when running inserts without batching (iterate and execute
statement) in mono my memory usage goes way of and while mono --profile
reports used mem about 40MB, linux swaps about 800MB. Why the
difference? Am I writing crappy code or just the GC freaking out? And
how should i implement the above code in mono?

/Fred

lör 2004-05-22 klockan 03.38 skrev Daniel Morgan:
> You need to provide more information, such as, what data provider are
> you using?  A simple test case would help too.  
> 
> -----Original Message-----
> From: mono-list-admin@lists.ximian.com
> [mailto:mono-list-admin@lists.ximian.com] On Behalf Of Fredrik Hedberg
> Sent: Friday, May 21, 2004 10:01 AM
> To: mono-list@lists.ximian.com
> Subject: [Mono-list] Batch inserts with ADO.NET
> 
> 
> Hi, 
> 
> What would be the best way do do batch inserts (like jdbc prepared
> statement) with ADO.NET. Currently while doing larger data inserts (1M
> and more) I'm experiencing some serious performance issues (related to
> memleaks in native/managed wrapper?). How does other people solve this?
> 
> Fred
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list