Re: [sqlite] how to COPY FROM stdin in 3.x?

Wed, 04 May 2005 14:22:05 -0700

Is this also true for for in memory databases? 
----- Original Message ----- 
From: "D. Richard Hipp" <[EMAIL PROTECTED]>
To: <sqlite-users@sqlite.org>
Sent: Wednesday, May 04, 2005 5:03 PM
Subject: Re: [sqlite] how to COPY <table> FROM stdin in 3.x?


On Wed, 2005-05-04 at 13:49 -0700, Darren Duncan wrote:
> At 1:27 PM -0700 5/4/05, scott wrote:
> >I can rewrite this to do individual inserts, but would like to find 
> >out whether there's a better workaround/idiom for this.
> 
> If you are going to use an INSERT statement, then your usage is a 
> prime candidate to use prepared statements with.  Your insert 
> statement is parsed once and then the actual data insert is 
> relatively little work and performs quickly.  I believe this sort of 
> activity is what happens to implement the you wanted anyway. -- 
> Darren Duncan
> 

Be sure to enclose your INSERTs inside a BEGIN...COMMIT.
Most of the time is spent doing COMMIT.  INSERT is very fast - 
many tens of thousands per second on a typical workstation.
But COMMIT is limited by disk rotation speed to about 60/sec.
(It is not possible to COMMIT faster than this and still
be ACID.) If you fail to enclose your INSERTs in a single
BEGIN...COMMIT then separate BEGIN...COMMITs are automatically
added around each INSERT, which really slows things down.
-- 
D. Richard Hipp <[EMAIL PROTECTED]>




Reply via email to