Reputation: 10173
I have a sqlite
database with 73 MB
when i'm running my application from hard disk it's first query is fast,but when i run my application form DVD first query take about 30 sec to run.
so i want to ask what's exactly happening when my app run form DVD?
can i improve database first query speed with spiting database to some small parts?
this is my query:
var SQlQuery = string.Format("SELECT ContentText FROM TblBookContent " +
"WHERE (BookID = {0}) AND (BookContentIndex={1}) Limit 1", bookid, BookContentIndex);
string ConString = string.Format("Data Source={0}{1}.s3db;Version = 3;",
CFAddress.ADatabase, DBName.BooksDB);
using (SQLiteConnection connection = new SQLiteConnection(ConString))
{
connection.Open();
using (SQLiteCommand command = new SQLiteCommand(SQlQuery, connection))
{
using (SQLiteDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
CHtmlDesign.HtmlFile = reader["ContentText"].ToString();
}
}
}
connection.Close();
}
Upvotes: 0
Views: 83
Reputation: 19185
I would guess it is more to do with the seek time on a DVD drive than anything else. CDs and DVDs have quite a slow seek time compared to a hard disk (HDD spin at 5000+ RPM, database servers will often be fitted with HDDs that spin above 11000RPM) while CDs and DVDs spin much slower and at variable speeds (maybe around 250 to 500RPM for CDs and 600 to 1300RPM for DVDs)
Those RPMs partially determine the seek time because if you need data on another part of the disk you have to speed up or slow down to the correct speed the rotation and wait for the part of the disk you want to arrive back at the read head. And if you don't move the read head to the part of the disk in time you have to wait for another rotation.
CDs and DVDs are very good at linear access (such as audio or video recordings) but are bad at random access because of the time taken to find the information you need.
Upvotes: 3