Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-08-16 Thread Tom
Hi guys, I've proceeded to test out whether SQLite could serve my needs and so far I am pretty optimistic that I can continue to use it at least until my game becomes massively popular. Wanted to share my results. My game does not in fact require a lot of write concurrency. It is just the daily

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-25 Thread Green
> Thanks guys, I have already tried WAL and it does speed things up, but I > still need the daily processing to be done asynchronously. The computations > are complex, involving around 16 inputs from the player table and resulting > in 8 outputs. This is core to the game and not a simple score

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-25 Thread Tom
Thanks Richard. Yeah I now need two threads writing concurrently - my requirements have changed from when I first started using SQLite. But anyway SQLite is awesome. Thank you. On Fri, Jul 25, 2014 at 6:58 PM, Richard Hipp-3 [via SQLite] < ml-node+s1065341n76965...@n5.nabble.com> wrote: > On Fr

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-25 Thread Markus Schaber
Hi, Von: Tom > This seems like a really major difference to MySQL. > MySQL with InnoDB allows concurrent writes to different rows in the same > table. > SQLite doesn't even allow concurrent writes to the same DB. > So MySQL has write concurrency, SQLite does not. Guess that's what I'm > learning

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-25 Thread Richard Hipp
On Fri, Jul 25, 2014 at 4:46 AM, Tom wrote: > I probably should have read the bit about concurrency on > http://www.sqlite.org/whentouse.html huh :-) > Although in my defense, my need for write concurrency is new. > I do wonder if 2 DB's will work well. > My understanding is that you have one re

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-25 Thread Richard Hipp
On Fri, Jul 25, 2014 at 1:58 AM, Tom wrote: > This seems like a really major difference to MySQL. > SQLite solves a completely different problem from MySQL. The two are not comparable. SQLite is striving to be an Application File Format. MySQL wants to be an Enterprise Data Depot. It sounds

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-25 Thread Tom
I probably should have read the bit about concurrency on http://www.sqlite.org/whentouse.html huh :-) Although in my defense, my need for write concurrency is new. I do wonder if 2 DB's will work well. On Fri, Jul 25, 2014 at 1:58 PM, Tom Spencer-Smith wrote: > > This seems like a really major

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-25 Thread Tom
This seems like a really major difference to MySQL. MySQL with InnoDB allows concurrent writes to different rows in the same table. SQLite doesn't even allow concurrent writes to the same DB. So MySQL has write concurrency, SQLite does not. Guess that's what I'm learning here. Maybe I should consid

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-25 Thread Tom
Thanks guys, I have already tried WAL and it does speed things up, but I still need the daily processing to be done asynchronously. The computations are complex, involving around 16 inputs from the player table and resulting in 8 outputs. This is core to the game and not a simple score leaderboard.

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-24 Thread Simon Slavin
On 24 Jul 2014, at 3:21pm, Tom wrote: > My application presently does all the DB operations on the main thread. But > once a day I need it do the player leaderboards, which could be 500K players > or so, hence several minutes. I can't have the main thread blocking for any > significant length of

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-24 Thread Richard Hipp
WAL mode (http://www.sqlite.org/wal.html) allows one process to write to the database while another reads. That might solve your problem. On Thu, Jul 24, 2014 at 10:21 AM, Tom wrote: > > OK that's what I figured. > > My application presently does all the DB operations on the main thread. But >

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-24 Thread Tom
OK that's what I figured. My application presently does all the DB operations on the main thread. But once a day I need it do the player leaderboards, which could be 500K players or so, hence several minutes. I can't have the main thread blocking for any significant length of time - a second or s

Re: [sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-24 Thread Simon Slavin
On 24 Jul 2014, at 8:01am, Tom wrote: > 1. read various fields from table A as inputs to the leaderboard calculation > 2. in a thread, compute leaderboard and write to table B (which main thread > doesn't write to). > > In other words, the main thread only writes to table A and the background >

[sqlite] Does SQLite lock the entire DB for writes, or lock by table?

2014-07-24 Thread Tom
I have a DB operation that will take a few minutes (computing a leaderboard) so it needs to be done in a background thread (with its own connection). I was hoping to do this: 1. read various fields from table A as inputs to the leaderboard calculation 2. in a thread, compute leaderboard and write