title: Advantage Database Server INSERT/UPDATE queries performance issues
body: <p>I'm using the <a href="http://www.sybase.com/products/databasemanagement/advantagedatabaseserver" rel="nofollow">Advantage Database Server v10</a> and the corresponding ADO.NET provider. I found that <code>AdsConnection.Close</code> takes significant amount of time after an executing of <code>INSERT/UPDATE</code> queries.</p>
  
  <p>For example this sample</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          var openTimer = new Stopwatch();
          var closeTimer = new Stopwatch();
          var executeTimer = new Stopwatch();
  
          for (int ix = 0; ix &lt; 100; ix++)
          {
              openTimer.Start();
              using (var cnn = new AdsConnection(
                  @"data source=...; ServerType=remote; user id=admin; password=..."))
              {
                  cnn.Open();
                  openTimer.Stop();
  
  
                  executeTimer.Start();
                  using (var cmd = cnn.CreateCommand())
                  {
                      cmd.CommandText = "SELECT MAX(colUGId) FROM tblUserGroup";
  
                      var id = (int)cmd.ExecuteScalar() + 1;
  
                      cmd.CommandText = "INSERT INTO tblUserGroup (colUGId, colName, colDesc) VALUES (:id, :name, :desc)";
                      cmd.Parameters.Add("id", id);
                      cmd.Parameters.Add("name", "Name " + id);
                      cmd.Parameters.Add("desc", "Description " + id);
                      cmd.ExecuteNonQuery();
                  }
                  executeTimer.Stop();
  
  
                  closeTimer.Start();
              }
              closeTimer.Stop();
          }
  
          Console.WriteLine("Open: {0}; Execute: {1}; Close: {2}", openTimer.Elapsed, executeTimer.Elapsed, closeTimer.Elapsed);
      }
  }
  </code></pre>
  
  <p>outputs:</p>
  
  <pre><code>Open: 00:00:00.2361612; Execute: 00:00:15.3849932; Close: 00:00:05.4333431
  </code></pre>
  
  <p>It is very interesting why 100 INSERT operations in the simple table with trivial indexes and without any triggers take 15 seconds. But the most important question: why <code>Close</code> takes so long? </p>
  
  <p>Any ideas?</p>
  
  <p><em><strong>UPDATE</em></strong></p>
  
  <p>Just tried the same with the SQL Server. It runs on a different workstation, which is a bit faster then the workstation with Advantage. Anyway, I can see that the connection pool works (in the case of SQL Server) good:</p>
  
  <pre><code>Open: 00:00:00.2279668; Execute: 00:00:00.0189551; Close: 00:00:00.0003487
  </code></pre>