我一直在尝试为我的项目评估 BrightStar DB,最初我所做的是 -
使用 brightstar DB (server sw) 我将我的 SQL Server 数据库表存储到它的默认存储中,即文件位置 ( C:\Program Files\BrightstarDB\Data
),然后为了测量与 SQL Server 数据库相比的性能提升,我尝试在内存和 SQL Server 中查询一个表并尝试加载到gridview。
令我惊讶的是,我可以看到直接从 SQL Server 加载数据所花费的时间是内存数据库的一半。我不知道这是否是检查性能的正确方法 - 如果有人在内存中工作过,请指导。
下面是用于直接从 SQL Server 加载的代码,在内存中我点击了这个链接http://brightstardb.com/documentation/Developing_With_BrightstarDB2.html。
protected void BtnDatabase_Click(object sender, EventArgs e)
{
try
{
GridView2.DataSource = null;
TDNdc = TextBox1.Text;
if (!string.IsNullOrEmpty(TDNdc))
selectCommand = "select * from dbo.TD_List where ID='" + TDNdc + "'";
String connectionString = @"data source=TD-abc\SQLEXPRESS;initial catalog=ScriptSave;integrated security=True";
DateTime varDateTime = DateTime.Now;
dataAdapter = new SqlDataAdapter(selectCommand, connectionString);
// Create a command builder to generate SQL update, insert, and
// delete commands based on selectCommand.
SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);
// Populate a new data table and bind it to the BindingSource.
DataTable table = new DataTable();
// table.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter.Fill(table);
TimeSpan result = DateTime.Now - varDateTime;
GridView2.DataSource = table;
GridView2.DataBind();
Response.Write("Time Taken to load " + GridView2.Rows.Count + " Record(s) From DB : " + result);
//LblInMem.Text = GridView2.Rows.Count + " Record(s) From DB : " + result;
//Response.Write("Time Taken to load datafrom DataBase " + result.ToString() + "Total Record :" + GridView2.Rows.Count);
}
catch (SqlException)
{
}
}