Received: from mail.tgd.net (mail.tgd.net [209.81.25.10]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0U6tOl76736 for ; Wed, 30 Jan 2002 01:55:24 -0500 (EST) (envelope-from sean@mail.tgd.net) Received: by mail.tgd.net (Postfix, from userid 1001) id F1D5B20F05; Tue, 29 Jan 2002 22:55:13 -0800 (PST) Date: Tue, 29 Jan 2002 22:55:13 -0800 From: Sean Chittenden To: Ferdinand Smit Cc: pgsql-admin@postgresql.org Subject: Re: INSERT performace. Message-ID: <20020129225513.A39839@ninja1.internal> References: <00a001c1a6d7$c833c520$7401a8c0@Home> <20020127091703.A16784@depesz.pl> <20020127113140.A64594@ninja1.internal> <200201290911.g0T9Bx501235@server9.telegraafnet.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <200201290911.g0T9Bx501235@server9.telegraafnet.nl>; from "ferdinand@telegraafnet.nl" on Tue, Jan 29, 2002 at = 10:11:46AM X-PGP-Key: 0x1EDDFAAD X-PGP-Fingerprint: C665 A17F 9A56 286C 5CFB 1DEA 9F4F 5CEF 1EDD FAAD X-Web-Homepage: http://sean.chittenden.org/ X-Archive-Number: 200201/256 X-Sequence-Number: 3137 > > > > We have a fresh database and have begun to observe performance > > > > degradation for INSERTs as a table went from empty to > > > > 100,000-ish rows. Initial INSERTs were sub second while after > > > > 30k rows, they were 1-3 seconds. > > > > > > we just hit this problem when moving old database to new one > > > (new schema). we had to insert approx. 1.5 million rows, and > > > from initial 0.02s/insert after several thousands of inserts it > > > came to 20 seconds per insert. what we did was removing foreign > > > keys from table which we made inserts to. it helped. we manage > > > to put 300k records in ca. 2-3 hours. > > > > If possible, use the COPY command. We did 90K rows in about 40sec > > using this puppy on a Solaris U5 (took over 130sec for MySQL on > > the same box in case the performance geeks in the crowd are > > interested). > > We were transfering a mysql-database to a new linux-server (PIII-800 > dual). I don't now how mutch rows, but the dump was 8 Gb (not > zipped). It took us 4 hours to import, and 5 hours to create the > indexes. How were you inserting the data? Were you doing multiple inserts per transactions? Copy? That sounds really slow to me. > By testing we created a postgres database to on an other server > (same type). The copy command did'nt work, because of 'strange > characters', so we used normal inserts. It took us 12 hours to > import, and 10 hours to create the indexes. Have you tried to escape the data before you inserted it? That should've solve things. http://www.postgresql.org/idocs/index.php?sql-copy.html > Although, i like postgres more, mysql is still faster with hugh > (simple) data. I've never found that to be the case in only a few instances actually... and typically with small data sets that are less than 1M rows. vacuum analyze and turn fsync off. :~) -sc -- Sean Chittenden