On Wed, 30 Jan 2002, Mike Lee wrote:
> No particular reason. MySQL seems to be the one that most people use for
> general purpose DB action.. :)
Personally, I prefer PostgreSQL, but that's more from the feature
perspecitve and not an efficiency perspective. I do remember several
benchmarks that showed current versions of PostgreSQL to be comparable to
MySQL for performance.
MySQL is a fine product, I'm not trying to disparage it. And with one
client, it may well be faster than PostgreSQL for raw inserts.
I just whipped up a very basic test. Please don't take this as indicative
of my usual approach to experimental rigor. :^)
Given the following table, with no indexes or constraints:
create table logtest (
id serial,
ts datetime,
payload varchar(1024)
)
I ran the following Python script:
---------- cut here ----------
#!/usr/bin/env python
import os, pg, re, string, sys
try:
db = pg.DB ('navtest', '')
except:
print 'Unable to open "navtest". Bye.'
sys.exit()
count = 0
iters = 10000
print 'Inserting %d records...' % iters
while count < iters:
db.query ("insert into logtest (ts,payload) values (now(),'This is a
fairly short test record.')")
count += 1
print 'Done.'
---------- cut here ----------
This took "0.27s user 0.15s system 0% cpu 1:01.53 total", according to
"time". Obviously time doesn't know about all the backend work being done
by the server process, but it looks like about 62 seconds for 10,000
inserts (including the call to the time() function). This comes out to
about 161 records per second.
Next I added the following:
create index logtest_ts_dx on logtest (ts)
Cleared the table and re-ran the inserter script, it's up to 65.5 seconds
for the 10000 inserts, or 153 inserts per second. Indexing clearly has a
noticible performance impact on inserts.
The test machine was a lightly-loaded dual 1 Ghz Coppermine (P3) running
RedHat 7.1 smp kernel. The version of PostgreSQL is 7.2 beta 4.
I do not have time at this moment to run the test against a MySQL
database. If anyone would like to do so, I would be most interested in the
results...
Nick
--
#include<stdio.h> /* SigMask 0.5 (sig.c) 20011019 PublicDomain */
int main(c,v)char *v;{return !c?putchar(*v-1)&&main(0,v+1):main(0
,"Ojdl!Wbshjti!=obwAogs/dpn?!OGS!Tfojps!Tpguxbsf!Fohjoffs\v\1");}
---------------------------------------------------------------------
To unsubscribe, e-mail: loganalysis-unsubscribe@securityfocus.com
For additional commands, e-mail: loganalysis-help@securityfocus.com
This archive was generated by hypermail 2b30 : Wed Jan 30 2002 - 08:38:30 PST