X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C798E329FAF for ; Tue, 12 Oct 2004 01:48:49 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21738-10 for ; Tue, 12 Oct 2004 00:48:37 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id CAD6B329E7B for ; Tue, 12 Oct 2004 01:48:40 +0100 (BST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i9C0maJ7025182 for ; Tue, 12 Oct 2004 00:48:36 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i9C0k884024812 for pgsql-sql@postgresql.org; Tue, 12 Oct 2004 00:46:08 GMT From: Christopher Browne X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Export tab delimited from mysql to postgres. Date: Mon, 11 Oct 2004 20:46:02 -0400 Organization: cbbrowne Computing Inc Lines: 28 Message-ID: References: <82E30406384FFB44AFD1012BAB230B5505F40D3E@shiva.au.lpint.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:GCXQqgWhXpJE4iKWzyvJ+HyYgw4= To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/78 X-Sequence-Number: 19181 Quoth Theo.Galanakis@lonelyplanet.com.au (Theo Galanakis): >         Could you provide a example of how to do this? > >         I actually ended up exporting the data as Insert statements, > which strips out cf/lf within varchars. However it takes an eternity > to import 200,000 records... 24 hours infact???? Is this normal? I expect that this results from each INSERT being a separate transaction. If you put a BEGIN at the start and a COMMIT at the end, you'd doubtless see an ENORMOUS improvement. That's not even the _big_ improvement, either. The _big_ improvement would involve reformatting the data so that you could use the COPY statement, which is _way_ faster than a bunch of INSERTs. Take a look at the documentation to see the formatting that is needed: http://techdocs.postgresql.org/techdocs/usingcopy.php http://www.faqs.org/docs/ppbook/x5504.htm http://www.postgresql.org/docs/7.4/static/sql-copy.html -- output = ("cbbrowne" "@" "ntlug.org") http://www3.sympatico.ca/cbbrowne/lsf.html Question: How many surrealists does it take to change a light bulb? Answer: Two, one to hold the giraffe, and the other to fill the bathtub with brightly colored machine tools.