A Note on Speed
With database systems, performance is always important. A badly designed client/server system can cost a great deal of money and have a shorter life than planned if attention is not paid to the way client applications interact with the server. Even with PC-based systems such as Access, database applications can often become slow, especially when multiple dynamic views of the data are used. Having discussed a wide range of data-access techniques, we now include some rough performance benchmarks. These are intended to show only the rough characteristics of different data-access APIs.
The standard task covered is to insert 1,000 rows into a simple
table. The sample table, named analysis, can be
thought of as a crude repository for financial data; it has four
fields, tranid
(integer),
trandate
(date),
account
(string) and
amount
(currency). To slow it
down a bit, it’s indexed uniquely on
tranid
and indexed with
duplicates allowed on trandate
and account
. Thus any insertion
involves updating three indexes. We created instances of this
database in our sample Access database and in Sybase SQL Anywhere. It
starts off empty. The tests were run on a Pentium 266, with client
and server on the same machine and no other activity taking place.
The source code for the test is in the module
fastinsert.py at http://starship.python.net/crew/mhammond/ppw32/
.
We first used mxODBC
to connect to both the Access and Sybase databases and tried three different techniques, which are ...
Get Python Programming On Win32 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.