Re: [pysqlite] database locked

Rich Shepard <[email protected]> Tue, 27 May 2008 07:34:53 -0700 (PDT)
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
On Tue, 27 May 2008, Eric S. Johansson wrote:

> (Question: what's the better solution for setting up databases when you
> have two tables, 150,000 entries or more and the other with potentially
> millions.  Should each table have its own set of files or should I put
> both tables in one file?)

   SQLite keeps all tables and other information in a single file. Relational
database management systems have tables; programming languages and operating
systems have files. They are not the same. Size limits are a function of
your OS and hard drives. Use indices to speed data access.

> (Question: is there any relationship between the number of records returned in
> time the database is locked?  There is one point in my application where I query
> for a "screens" worth of data and get far more than I need because I need to
> sort it and massage it for presentation.  Would there be value in leading SQL
> light sort and then return only the first X elements?)

   The set of records returned by a query is determined by both how you write
the query and how you access the returned set for display. Sorting is an
independent of the query, but can be included in the query using the SQL
command of ORDERED BY.

   From your questions it appears that you might benefit from reading a book
on SQL and (or in addition to) Mike Owen's excellent book, "The Definitive
Guide to SQLite."

Rich

-- 
Richard B. Shepard, Ph.D.               |  Integrity            Credibility
Applied Ecosystem Services, Inc.        |            Innovation
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863