SQLite插入1000行数据居然耗时9秒。。
static void Main(string[] args)
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
SQLiteConnection connection = new SQLiteConnection("Data Source=" + directoryName + @"\Test.db");
connection.Open();
SQLiteCommand commandClearDB = new SQLiteCommand("delete FROM highscores", connection);
commandClearDB.ExecuteNonQuery();
DateTime now = DateTime.Now;
for (int i = 0; i < 1000; i++)
{
SQLiteCommand command = new SQLiteCommand("insert into highscores (name, score) values ('Me', 3000)", connection);
command.ExecuteNonQuery();
}
SQLiteCommand commandCount = new SQLiteCommand("select count(*) from highscores", connection);
object count = commandCount.ExecuteScalar();
string tip = ((DateTime.Now - now)).TotalMilliseconds.ToString();
Console.WriteLine(tip);
Console.WriteLine("数据行:" + count);
Console.ReadKey();
}
相关推荐
SQLite 大数据测试
SQLite 大数据量导入SQLite性能测试 较为理想 1000W 数据 265M 213s 搞定
execSQL和SQLiteStatement的executeInsert方法插入1000条数据所需要的时间对比
execSQL和SQLiteStatement的executeInsert方法插入1000条数据所需要的时间对比
SQLite速度评测代码
今天有个朋友测试 SQLite,然后得出的结论是:SQLite 效率太低,批量插入1000条记录,居然耗时 2 分钟! 下面是他发给我的测试代码。我晕~~~~~~ using System.Data; using System.Data.Common; using System.Data.SQLite; // 创建数据库文件 File.Delete(“test1.db3”); SQLiteConnection.CreateFile(“test1.db3”); DbProviderFactory factory = SQLiteFactory.Instance; using (DbConnect
在Titanium中通过使用BEGIN/COMMIT来加速SQLite插入操作
NULL 博文链接:https://rensanning.iteye.com/blog/1464360
C#操作SQLite数据库方法小结(创建,连接,插入,查询,删除等)
本文实例讲述了C#操作SQLite数据库方法。分享给大家供大家参考,具体如下: SQLite介绍 SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite是一个开源、免费的小型RDBMS(关系型数据库),能独立运行、无服务器、零配置、支持事物,用C实现,内存占用较小,支持绝大数的SQL92标准。 SQLite数据库官方主页:http://www.sqlite.org/index.h


其他数据库
