From: | Lincoln Yeoh <lylyeoh(at)mecomb(dot)com> |
---|---|
To: | pgsql-general(at)postgreSQL(dot)org |
Subject: | Re: [GENERAL] Postgres INSERTs much slower than MySQL? |
Date: | 1999-10-20 04:25:50 |
Message-ID: | 3.0.5.32.19991020122550.008bf780@pop.mecomb.po.my |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Hi everyone,
Should inserts be so slow?
I've written a perl script to insert 10 million records for testing
purposes and it looks like it's going to take a LONG time with postgres.
MySQL is about 150 times faster! I don't have any indexes on either. I am
using the DBI and relevant DBD for both.
For Postgres 6.5.2 it's slow with either of the following table structures.
create table central ( counter serial, number varchar (12), name text,
address text );
create table central ( counter serial, number varchar (12), name
varchar(80), address varchar(80));
For MySQL I used:
create table central (counter int not null auto_increment primary key,
number varchar(12), name varchar(80), address varchar(80));
The relevant perl portion is (same for both):
$SQL=<<"EOT";
insert into central (number,name,address) values (?,?,?)
EOT
$cursor=$dbh->prepare($SQL);
while ($c<10000000) {
$number=$c;
$name="John Doe the number ".$c;
$address="$c, Jalan SS$c/$c, Petaling Jaya";
$rv=$cursor->execute($number,$name,$address) or die("Error executing
insert!",$DBI::errstr);
if ($rv==0) {
die("Error inserting a record with database!",$DBI::errstr);
};
$c++;
$d++;
if ($d>1000) {
print "$c\n";
$d=1;
}
}
From | Date | Subject | |
---|---|---|---|
Next Message | Charles Tassell | 1999-10-20 05:56:56 | Re: [GENERAL] Postgres INSERTs much slower than MySQL? |
Previous Message | Carsten Huettl | 1999-10-19 23:01:24 | Re: [GENERAL] ld.so failed |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1999-10-20 04:29:36 | Re: [HACKERS] mdnblocks is an amazing time sink in huge relations |
Previous Message | Hiroshi Inoue | 1999-10-20 04:05:06 | RE: [HACKERS] mdnblocks is an amazing time sink in huge relations |