0

Is there any database that is only meant for storing string variables?

I am currently using Sqlite library in C# but its working slow for me. As Sqlite lets you store multiple data types. I am looking for something that is optimized for storing string variables.

If your answer is still Sqlite then my coding must be the problem for making the transactions slow.

Basically I am calling in a loop where I just add the strings into an 'INSERT' command that executes in the loop.

here is what the code looks like:

sql_connection = new SQLiteConnection("Data Source=File.db;Version=3;New=False;Compress=True;");
sql_connection.Open();
sql_cmd = sql_connection.CreateCommand();
 for (int x = 0; x < Count; x++)
{
    sql_cmd.CommandText = "INSERT INTO main_list (File_Name, File_Location) VALUES (\'" + grid_file_list.Rows[x].Cells[0].Value.ToString() + "\', \'" + grid_file_list.Rows[x].Cells[1].Value.ToString() + "');";
    sql_cmd.ExecuteNonQuery();
}
  • Can you post the code you are using? I suspect this is an [XY Problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). – Steve Mar 20 '17 at 05:25
  • @Steve ok, I am don't have the code but I can give like a pseudo code –  Mar 20 '17 at 05:27
  • what is the size of varchar variable you are using? – fatihk Mar 20 '17 at 05:30
  • @ChicagoTed its approx 100 chars along or less –  Mar 20 '17 at 05:47
  • 1
    Is that all you're storing in this database? Or are there other tables in there that relate to this? How many records do you expect? If this is all you're storing, you could probably use some kind of NoSQL database instead. A quick tip though: You should be able to tack all those inserts together in one giant ; delimited statement and run it once. There might be an upper limit so try 5 inserts at once and work your way up – Nick.Mc Mar 20 '17 at 06:00
  • Part of what is making it slow is poking around in the grid to get data (DataGridView?) then converting to string. You are doing that 2ce per INSERT and then concatenating some strings. All that takes time and nothing to do with SQLite. if it IS a DataGridView, you dont need a loop, just one line of code...*maybe* a transaction – Ňɏssa Pøngjǣrdenlarp Sep 28 '17 at 17:16

0 Answers0