<asheu@...> writes:

> 
> > If we import the same text file into a MS Access database using INSERT INTO
MDE SELECT * FROM 
> > [Text;Database=C:\\folder].[filename.txt], it takes about a minute and half
but because SQLite does
> not support that, I have to 
> > use the insert into statement for every record inside a transaction (every
10,000 records), it's taking 6
> mins 30 secs to import 
> > the whole file. 
> 
> > >Make sure you prepare the statement once, then just bind parameters for
every row. 
> 
> In general, below is what I am doing... 
> cmd->CommandText = "INSERT INTO tablename VALUES (@field1, @field2, ...)"; 
> adpt->InsertCommand = cmd; 
> setup params 
> 
> while read line from text file 
> insert record to DataTable 
> every 10000 records 
> { 
> SQLiteTransaction^ t = cn->BeginTransaction(); 
> cmd->Transaction = t; 
> adpt->Update(DataTable); 
> t->Commit(); 
> } 

try to simplify by only using the CLI (sqlite3) and the file with your INSERT
statements as 1 transaction. If you still need this much time you might use
indexes or Foreign Key constraints that slow the whole thing down.

oliver



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to