Re: MySQL vrs SQLite

From: David M. Cooke (cookedm+news_at_physics.mcmaster.ca)
Date: 05/07/04


Date: Thu, 06 May 2004 23:57:42 -0400

At some point, Michael <mogmios@mlug.missouri.edu> wrote:

>>In short, sqlite is a *very* capable little database, as long as it only
>>ever has one user. More than one user, and it'll block access so only one
>>user may access it at a time.
>>
> It does block though - it doesn't loss data if more than one program
> tries to access it at once? In this case I have multiple programs that
> need to write to, and read from, the db in a reliable way. Most of the
> actions should be small so I don't think blocking should pose a big
> question but data loss would be very bad.

>From the sqlite library FAQ on sqlite.org:

(7) Can multiple applications or multiple instances of the same
    application access a single database file at the same time?

    Multiple processes can have the same database open at the same
    time. Multiple processes can be doing a SELECT at the same time.
    But only one process can be making changes to the database at
    once.

So, your process will block only if something else is changing the
database. It also journals the changes to the database, so interrupted
transactions are rolled back.

>>SQLite treats all data as strings, but note that it does some internal
>>"typecasting" such that a column of numbers will be sorted numerically. You
>>will need to implement your own data conversion though. It's usually as
>>trivial as a simple mapping containing conversion functions like (from the
>>Roundup source):
>>
> I always type cast, and otherwise clean, all data coming in and out of
> my db functions anyway (for security reasons) so that isn't a problem.
> Since SQLite stores data as strings that means data such as numbers
> will take up more space than in a db such as MySQL?

Depends. If your numbers as strings are less than four bytes, they
should take less space :-)

Also, by default, the Python wrapper (pysqlite.sf.net) converts rows
declared as integer and float to the appropiate Python types. And
there's a way to pass type info before a statement so it does the
conversion for you.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca


Relevant Pages

  • Web Developers - Happy Hearts And HDTV! - Lockergnome
    ... Certificate on your MSIIS Web server. ... getting data from a database is only half the problem. ... Zend recently started a series about building rock solid code in PHP. ... which provides bulk database conversion. ...
    (freebsd-questions)
  • Re: Converting database from Access 97 to 2003: problems
    ... Although the owner of the database had all the rights the conversion was not ... placed the Admin user in the Admins group (Admins group has Administrator ...
    (microsoft.public.access.conversion)
  • Re: MDW
    ... using the MDB at the same time. ... When Access 2003 enables the database, ... Multi-User Databases are databases which have an associated WIF (Workgroup ... that could complicate the conversion process. ...
    (microsoft.public.access.gettingstarted)
  • RE: Conversion from VT_DECIMAL TO VT_I8 failed
    ... Welcome to MSDN newsgroup. ... Regarding on the Type Converting problem met in accessing database through ... Conversion from VT_DECIMAL TO VT_I8 failed ...
    (microsoft.public.data.oledb)
  • Converting from Access97 to Access 2002 -- OpenCurrentDatabase or OpenDatabase
    ... the routine opens an initialized converted database (i.e. one ... without any custom objects), then opens the Access97 database, exports the ... that doesn't seem to affect the conversion). ...
    (microsoft.public.access.conversion)