On Wed, Nov 28, 2012 at 6:47 AM, Alejandro Martínez <elpeq...@gmail.com>wrote:

> I have one process that each 30 minutes refills several tables in this
> manner:
>
> sqlite3_open_v2(CACHEDB_PATH, &sqcache_conn, SQLITE_OPEN_CREATE |
> SQLITE_OPEN_READWRITE, NULL)
>
> - For each table:
>
> begin deferred transaction; delete from [table];
> insert into table ...
> insert into table ...
> insert into table ...
> insert into table ...
> [up to 180.000 rows]
> commit;
>
> and sometimes the commit fails, so it is retried. (why would it fail? its
> the only  writter)
>
> And then i have many other processes that open that sqlite database read
> only. sqlite3_open_v2(_dbfile, &sqcache_conn, SQLITE_OPEN_READONLY, NULL)
> and sqlite3_busy_timeout(sqcache_conn, 5000)
>
> These processes create very simple prepared statements to query that
> tables.
>
> And the big problem i'm having, is that when i step these prepared
> statements, they lock for 5 seconds and then fail.
>
> And i put that busy timeout just for completeness, cause i wasn't expecting
> any locking because for being a read only query.
>
> I really need these queries not to lock or fail.
>

Enable WAL mode.  "PRAGMA journal_mode=WAL".  http://www.sqlite.org/wal.html



>
> What am i doing wrong?
> Any suggestions?
>
> Thank you,
> Alejandro
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to