Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id D6A0EB5DC5A for ; Mon, 29 Aug 2011 11:36:10 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 90954-01 for ; Mon, 29 Aug 2011 14:36:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pz0-f42.google.com (mail-pz0-f42.google.com [209.85.210.42]) by mail.postgresql.org (Postfix) with ESMTP id 8608AB5DC2B for ; Mon, 29 Aug 2011 11:36:04 -0300 (ADT) Received: by pzk37 with SMTP id 37so14450483pzk.15 for ; Mon, 29 Aug 2011 07:36:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=jM98uWlFW4rB7fAX+dE/6nDd5MfulOWg5ICnvpBv5sc=; b=l98yA0UQfeVraFSTs2BOuwIQtTCj0eLJBKR8OdFDwgcrIypKvyO8ee1G2+23Vpv9Rv PFY8E9SL2cKV7DbkuxR0JiEN63ZK5PoqxNbj4GLGAgpe6tGAGgJbXvkHg1JDGL3DNyKP rudPZTe4ZfF4+MHGgdMU7WQE4qbcj2s3JovXI= Received: by 10.142.217.3 with SMTP id p3mr2402268wfg.166.1314628564585; Mon, 29 Aug 2011 07:36:04 -0700 (PDT) Received: from [192.168.11.3] ([116.225.153.151]) by mx.google.com with ESMTPS id u2sm18878444pbq.9.2011.08.29.07.35.54 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 29 Aug 2011 07:36:03 -0700 (PDT) Message-ID: <4E5BA3C0.7080909@gmail.com> Date: Mon, 29 Aug 2011 22:35:44 +0800 From: Rural Hunter User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: Kevin Grittner CC: Julio Leyva , pgsql-admin@postgresql.org Subject: Re: plsql gets "out of memory" References: <4E5B8FF7.4040007@gmail.com> <4E5B9604.5070602@gmail.com> <4E5B518002000025000407E5@gw.wicourts.gov> In-Reply-To: <4E5B518002000025000407E5@gw.wicourts.gov> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001 X-Spam-Level: X-Archive-Number: 201108/226 X-Sequence-Number: 38213 yes, the size of my database(around 200g) is very close to yours. How long did it take you to migrate the data(100-200G)? I thought about to write java code to transfer the data but it's a bit trivial. It would be the best if I can complete this with regular export/import way. if that won't work, then writing java code to do the task will be the choice. Another problem is, from my test, the performance of bulk insert looks not very good. I estimated the importing of 30G data would take about 10-20 hours based on the progress. I already did some tweaks such as: fsync=off archive_mode=off Increase checkpoint_segments drop indexes and primary keys I have about 5G memory free on the server and have these memory settings: shared_buffers = 1GB work_mem = 8MB maintenance_work_mem = 1GB effective_cache_size = 4GB Not sure if there is any room to increase the performance of bulk insert. I monitored the server when the import running. The utilization of CPU/disk is very low. The memory usage seems no much change when pgsql is up or down. So looks the performance bottleneck is not on cpu/disk/memory. I'm a bit lost on this and have no idea what to check/change. 于 2011/8/29 21:44, Kevin Grittner 写道: > Rural Hunter wrote: > >> it's a problem of migrating vast data from mysql to pgsql. > > I don't know how helpful you'll find this, but when we migrated to > PostgreSQL a few years ago, we had good luck with using Java to > stream from one database to another. Be sure to include a lot of > inserts in each database transactions. We used prepared statements > for the inserts. > > I don't know whether you would consider our data "vast" -- we had > about 100 production databases. At the time the largest was 200 GB. > > -Kevin >