Slow write to sqlite on usb sticks

Peter Haworth pete at lcsql.com
Thu Apr 26 19:36:24 EDT 2012


Once again, this varies form db to db.  Even sqlite3 can now allow readers
while the db is locked by setting the Write Ahead Locking pragma.

For mySQL, there is a LOCK and an UNLOCK command which allow you to lock
individual tables for read and/or write access, as well as BEGIN and END,
which lock the whole database.  There's a discussion on how LOCK/UNLOCK and
BEGIN/END work here<http://dev.mysql.com/doc/refman/5.5/en/lock-tables-and-transactions.html>
but
I'd be inclined to use LOCK and UNLOCK rather than BEGIN/END for more
granularity unless you are carrying out some admin task for which you need
exclusive access to the whole db.

I don't know anything about locking on other SQL implementations (yet!).

Pete
lcSQL Software <http://www.lcsql.com>



On Thu, Apr 26, 2012 at 3:22 PM, Bob Sneidar <bobs at twft.com> wrote:

> Oh thanks. I was aware that beginning a transaction made the database
> writable by only the client who began the transaction, but does it lock
> people out of reads as well? In the past I would manually lock a database
> while inserting records or before doing a transactional update, so that I
> could mark a particular master record as read only. I would then unlock the
> database and update as necessary to minimize the impact on other users. I
> did this only because that was what an old app called SBT written in Foxpro
> used to do, and that was all I knew at the time, but with transactions,
> maybe I don't need to worry about that anymore.
>
> Bob
>
>
> On Apr 26, 2012, at 3:14 PM, Peter Haworth wrote:
>
> > I think you're using mySQL Bob?  If so, be aware that BEGIN and END are
> > also the means by which you lock the database.  Doesn't matter too much
> > with sqlite because it's basically a single user db but with multi user
> dbs
> > like mySQL (actually just about any db other than sqlite), locking is a
> > whole other story!
> >
> > Pete
> > lcSQL Software <http://www.lcsql.com>
> >
> >
> >
> > On Thu, Apr 26, 2012 at 2:58 PM, Bob Sneidar <bobs at twft.com> wrote:
> >
> >> Yes, transactions... good! I need to incorporate them into my app when I
> >> am ready to go into production (as if I will ever get to that point!).
> >>
> >> Bob
> >>
> >>
> >> On Apr 26, 2012, at 2:38 PM, Terry Judd wrote:
> >>
> >>> Wow, thanks Pete - I'll definitely give this method a try.
> >>>
> >>> Terry..
> >>
> >>
> >> _______________________________________________
> >> use-livecode mailing list
> >> use-livecode at lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list