Jump to content

Sqlite Veri Cekme


korasoglu
 Share

Recommended Posts

Arkadaşlar SQlite ile aşağıdaki kodla Beş Milyon satırı 15 saniyede yazdırdım (Pc den Pc ye değişir) ama çekme işlemi çok yavaş oluyor veriyi hızlı bir şekilde çekme işlemini nasıl yapabilirim.
 
SQLiteConnection con;
            SQLiteCommand cmd;
  
 
            con = new SQLiteConnection("Data Source=OrnekVt.sqlite;Version=3;");
            string sql = @"CREATE TABLE IF NOT EXISTS Ogrenci(
                               OgrNo INTEGER PRIMARY KEY AUTOINCREMENT ,
                               Ad           TEXT      NOT NULL,
                               Soyad            TEXT       NOT NULL
                            );";
                
                con.Open();
                cmd = new SQLiteCommand(sql, con);
                cmd.ExecuteNonQuery();
              var stopwatch = new Stopwatch();
              stopwatch.Start();
              cmd = new SQLiteCommand();
 
 
              using (cmd = new SQLiteCommand(con))
              {
                 using (var transaction = con.BeginTransaction())
                  {
                      for (var i = 0; i < 5000000; i++)
                      {
                        cmd.CommandText = "insert into Ogrenci(Ad,Soyad) values ('Ali','Bak')";
                        cmd.ExecuteNonQuery();
                      }
 
 
                      transaction.Commit();
                  }
            }

          MessageBox.Show(string.Format("{0} saniye sürdü", stopwatch.Elapsed.TotalSeconds));

            con.Close();

NOT : Aynı işlemi sql server ile tekrarladım veri çekme hızı yine düşük oldu. Çok büyük projelerde veri işleyenler nasıl bir yol takip ediyor çok merak ettim.

Edited by korasoglu
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...