Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28015

Re: Python 2.6 and Sqlite3 - Slow

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'python': 0.09; 'fetch': 0.09; 'part,': 0.09; 'sqlite': 0.09; 'tends': 0.09; 'cc:addr:python-list': 0.10; '2.7': 0.13; 'file,': 0.15; '(via': 0.16; 'cage': 0.16; 'csv': 0.16; 'echo': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'great!': 0.16; 'hell.': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:edu.au': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'simpson': 0.16; 'statement.': 0.16; 'suggesting': 0.16; 'wrote:': 0.17; 'network,': 0.18; 'saying': 0.18; 'file.': 0.20; 'written': 0.20; 'trying': 0.21; 'do.': 0.21; 'finally,': 0.22; 'cheers,': 0.23; 'cc:2**0': 0.23; 'mention': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'select': 0.26; 'possibly': 0.27; 'format,': 0.27; 'record': 0.28; 'end,': 0.29; 'probably': 0.29; 'file': 0.32; 'doubt': 0.33; 'everyone': 0.33; 'requirements': 0.33; 'that,': 0.34; 'text': 0.34; 'server': 0.35; 'remote': 0.35; 'something': 0.35; 'but': 0.36; 'data.': 0.36; 'received:au': 0.36; 'charset:us-ascii': 0.36; 'display': 0.36; 'does': 0.37; 'why': 0.37; 'item': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'performance': 0.39; 'your': 0.60; 'content- disposition:inline': 0.60; 'first': 0.61; 'kind': 0.61; 'email addr:gmail.com': 0.63; 'drive,': 0.65; 'records': 0.68; '_still_': 0.84; 'fro': 0.84; 'net,': 0.84; 'transactions': 0.91; 'from.': 0.93
Date Tue, 28 Aug 2012 18:27:37 +1000
From Cameron Simpson <cs@zip.com.au>
To bruceg113355@gmail.com
Subject Re: Python 2.6 and Sqlite3 - Slow
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <d6e9f696-da86-4aa3-8930-69cf33dd2837@googlegroups.com>
User-Agent Mutt/1.5.21 (2010-09-15)
References <d6e9f696-da86-4aa3-8930-69cf33dd2837@googlegroups.com>
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3896.1346142467.4697.python-list@python.org> (permalink)
Lines 52
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1346142467 news.xs4all.nl 6850 [2001:888:2000:d::a6]:42888
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28015

Show key headers only | View raw


On 27Aug2012 13:41, bruceg113355@gmail.com <bruceg113355@gmail.com> wrote:
| When using the database on my C Drive, Sqlite performance is great!   (<1S)
| When using the database on a network, Sqlite performance is terrible! (17S)

Let me first echo everyone saying not to use SQLite on a network file.

| I like your idea of trying Python 2.7

I doubt it will change anything.

| Finally, the way my program is written is:
|   loop for all database records:
|      read a database record
|      process data
|      display data (via wxPython)
| 
| Perhaps, this is a better approach:
|      read all database records
|      loop for all records:
|         process data
|         display data (via wxPython)

Yes, provided the "read all database records" is a single select
statement. In general, with any kind of remote resource you want to
minimise the number of transactions - the to and fro part, because each
such item tends to have latency while something is sent to and again
receiving from. So if you can say "gimme all the records" you get one
"unit" of latency at the start and end, versus latency around each
record fetch.

Having said all that, because SQLite works directly against the file, if
you say to it "giev me all the records" and the file is remote, SQLite
will probably _still_ fetch each record individually internally, gaining
you little.

This is why people are suggesting a database "server": then you can say
"get me all the records" over the net, and the server does
local-to-the-server file access to obtain the data. So all the "per
record" latency is at its end, and very small. Not to mention any
cacheing it may do.

Of course, if your requirements are very simple you might be better off
with a flat text file, possibly in CSV format, and avoid SQLite
altogether.

Cheers,
-- 
Cameron Simpson <cs@zip.com.au>

I do not trust thee, Cage from Hell, / The reason why I cannot tell, /
But this I know, and know full well: / I do not trust thee, Cage from Hell.
        - Leigh Ann Hussey, leighann@sybase.com, DoD#5913

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python 2.6 and Sqlite3 - Slow bruceg113355@gmail.com - 2012-08-26 18:23 -0700
  Re: Python 2.6 and Sqlite3 - Slow Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-08-27 17:50 +0200
    Re: Python 2.6 and Sqlite3 - Slow ahsanraza211@gmail.com - 2012-08-27 09:53 -0700
    Re: Python 2.6 and Sqlite3 - Slow bruceg113355@gmail.com - 2012-08-27 13:41 -0700
      Re: Python 2.6 and Sqlite3 - Slow Cameron Simpson <cs@zip.com.au> - 2012-08-28 18:27 +1000
        Re: Python 2.6 and Sqlite3 - Slow bruceg113355@gmail.com - 2012-08-28 10:25 -0700
          Re: Python 2.6 and Sqlite3 - Slow Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-28 17:20 -0400
          Re: Python 2.6 and Sqlite3 - Slow Pedro Larroy <pedro.larroy.lists@gmail.com> - 2012-08-29 00:01 +0200
        Re: Python 2.6 and Sqlite3 - Slow bruceg113355@gmail.com - 2012-08-28 10:25 -0700
  Re: Python 2.6 and Sqlite3 - Slow Demian Brecht <demianbrecht@gmail.com> - 2012-08-27 13:54 -0700
    Re: Python 2.6 and Sqlite3 - Slow bruceg113355@gmail.com - 2012-08-27 17:55 -0700
      Re: Python 2.6 and Sqlite3 - Slow Bryan <bryanjugglercryptographer@yahoo.com> - 2012-08-27 19:32 -0700
        Re: Python 2.6 and Sqlite3 - Slow bruceg113355@gmail.com - 2012-08-27 20:09 -0700
          Re: Python 2.6 and Sqlite3 - Slow Bryan <bryanjugglercryptographer@yahoo.com> - 2012-08-27 22:26 -0700
          Re: Python 2.6 and Sqlite3 - Slow Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-28 01:33 -0400

csiph-web