• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: SQLite optimization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SQLite optimization


  • Subject: Re: SQLite optimization
  • From: Aaron Burghardt <email@hidden>
  • Date: Tue, 29 Aug 2006 08:50:03 -0400


On Aug 29, 2006, at 1:16 AM, Ruslan Zasukhin wrote:

On 8/28/06 1:48 PM, "Mark Gilbert" <email@hidden> wrote:

Hi Mark,

Hi There.

My app accesses the same SQlite database from several threads, and in
order to accommodate this I currently open and close the database on
each access, and the various threads will wait when the database is
busy on another thread.

This all works OK, but I am finding performance issues, which I think
may be related to the opening and closing.

My idea is to limit access to the database to a single intermediate
thread, with each other thread passing their requests through the
'owner' thread for the SQLite database.  My hope is that this thread
can leave the database permanently open with a large cache size and
consequently speed things up.

In fact SQL Lite self do open/close of db file for each transaction.
This was idea of its author. Many solutions in SQL Lite design rely on this
idea, and this is why it is underlined that "SQLLite is single user engine".


You don't say whether you are querying the database or inserting data. SQLite does not open the db file for each SQL statement, but when inserting data it creates a separate journal file for each transaction, so there is a fair amount of overhead per insert transaction. As another reply stated, you can keep several open connections (and they can be from separate threads) to the db and let the SQLite take care of synchronization.

Would anyone with experience in SQLite performance care to comment if
this is a good strategy to improve performance ?

I suggest you try keeping your connections open and batching inserts in a transaction, if you are doing a lot of inserts.

----
Aaron Burghardt
email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: SQLite optimization
      • From: Ruslan Zasukhin <email@hidden>
References: 
 >Re: SQLite optimization (From: Ruslan Zasukhin <email@hidden>)

  • Prev by Date: Re: SQLite optimization
  • Next by Date: Re: SQLite optimization
  • Previous by thread: Re: SQLite optimization
  • Next by thread: Re: SQLite optimization
  • Index(es):
    • Date
    • Thread