On Sun, 02 Oct 2011 21:20:27 +0800, ?????? <[email protected]>
wrote:

> thank you very much for replying me. my application is really
> very slow when insert data, and i have tried translation.

I guess you mean transaction, not translation?

> but it does not increase speed. so what can i do? 

Did you execute many INSERT statements in a 
BEGIN TRANSACTION; / COMMIT TRANSACTION; pair, 
or just one INSERT statement?

To tell more we need more information about your problem, like:
- the database schema
- the code you use to execute INSERT statements
- some information about your hardware environment
- the speed you experience
- the speed you would need

A few general speed improvemnt hints:

1) Put the database in a very fast filesystem,
   like Solaris tempfs (memory) or a RAMdisk.
   If that is not possible, build an in-memory database
   and transfer it to a disk file using the backup API.

2) PRAGMA page_size={the optimal database page size
   for your filesystem and average row size};
   If you want store BLOBs, use a larger page_size, 
   and put the blob columns in a separate table using
   the same primary key and join with the primary table
   if you need the blob in the resultset.

3) PRAGMA cache_size={many pages};
   PRAGMA default_cache_size={many pages};

4) PRAGMA jounal_mode=OFF; -- note: use with caution.

5) PRAGMA synchronous=OFF;

6) PRAGMA temp_store=MEMORY;

7) PRAGMA foreign_keys=OFF;

9) Sort INSERT statements in the order of the key of the most
complicated index.

10) Postpone CREATE INDEX statements until after all tables are
loaded.

Once the database is complete:
11) VACUUM;
12) ANALYZE;

13) when possible use INTEGER primary keys.

Probably there are a few more.

See also:
http://www.sqlite.org/pragma.html
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to