Home All Groups Group Topic Archive Search About

MS data provider for oracle is much slower than ODP.NET

Author
1 Mar 2006 2:03 PM
cmurialdo
Microsoft oracle data provider doesn't implement the statement caching
feature which was added to Oracle data provider in version 10.1.0.3.0.

I have a simple program (*) which inserts 20000 records into a table. Using
Microsoft data provider for Oracle it takes 1 minute to execute. Using the
Oracle Data Provider for .NET (version 10.2.0.100) and the statement chaching
feature it takes 25 seconds.
I know that Microsoft does not have a published schedule for including
statement caching for the Oracle .NET provider.
So my question is, are there plans to add features that improve the
performance on that type of programs (which execute many times the same
statement)?.


(*):

using System;
using System.Data;
using System.Data.OracleClient;

namespace Oracle
{
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    public class Class1
    {
        static void Main(string[] args)
        {
            OracleConnection conn = new OracleConnection("Data
Source=oracle10gr2;;User ID=TSDBNTAG2YI;Password=tsdbntag2yi;");
            IDbTransaction trn=null;
            try
            {
                conn.Open();

                trn = conn.BeginTransaction(IsolationLevel.ReadCommitted);



                IDbCommand cmdDelete = new OracleCommand("DELETE FROM TRN01",
(OracleConnection) conn);
                cmdDelete.Transaction = trn;
                cmdDelete.ExecuteNonQuery();



                DateTime d1 = DateTime.Now;
                IDbCommand cmd = new OracleCommand( "INSERT INTO TRN01 (A, B) VALUES
(:A, :B)", conn);
                cmd.CommandTimeout=0;
                cmd.Transaction = trn;

                OracleParameter parm1 = new OracleParameter( "A", OracleType.Number, 10);
                OracleParameter parm2 = new OracleParameter("B", OracleType.Char, 20);
                cmd.Parameters.Add(parm1);
                cmd.Parameters.Add(parm2);

                int i=0;
                while (i < 20000)
                {

                    parm1.Value=i;
                    parm2.Value="A";
                    cmd.ExecuteNonQuery();
                    i ++;
                }
                trn.Commit();

                DateTime d2 = DateTime.Now;

                Console.WriteLine("Tiempo: " + TimeSpan.FromTicks(d2.Ticks -
d1.Ticks).Minutes + ":" +
                    TimeSpan.FromTicks(d2.Ticks - d1.Ticks).Seconds + " seconds");

            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                conn.Close();
            }

        }
    }
}

AddThis Social Bookmark Button