Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f6M1I-0003Ph-Kt for pgsql-general@arkaria.postgresql.org; Wed, 11 Apr 2018 20:07:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f6M1H-0007XF-HH for pgsql-general@arkaria.postgresql.org; Wed, 11 Apr 2018 20:07:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f6M1G-0007Su-CH for pgsql-general@lists.postgresql.org; Wed, 11 Apr 2018 20:07:03 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f6M1C-00017O-VY for pgsql-general@postgresql.org; Wed, 11 Apr 2018 20:07:01 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 69D7821165; Wed, 11 Apr 2018 16:06:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 11 Apr 2018 16:06:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=lrLGXpFz21yW8PSidEAeR3ZtWiI8r NVJ2tpZNjWFaas=; b=YZzUWOUF1cp531MkX7I6v7BFgBplHmUrBgu54AzKp1rVM 1iy4utoL+88CxsnKZ529flD7cMtUlZ7UzWmtk1fFO5GTBWClrSOZRV6eHoFO7NeP S/BvdXr2+na+WQo9oeKJtNBiiIQvkHO8EYqUG5LCd1m7stmQpJgIdgD7IIeo5Xfn W/MI0tR/AKzdn/DnAVp+0mQ2DWPwc2URdjteX5m8s3i2VRBmJ/s58cGvUakyqXpl //095q+wu+T4N0OmDYOhAAp26oMf5MyzY5JyC9whgzPZo6+poUKJi343KAz4Ookp GZBAaIjnTneLhsAof1swDwbqH3YiAPY6aPduwedlQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=lrLGXp Fz21yW8PSidEAeR3ZtWiI8rNVJ2tpZNjWFaas=; b=SnpM3aTOiN2j0jYgH34FF+ 2bjEerbAn/5Eu5xwOqr29gCnqb+oTWQAlr2g+n+3SA/NN1n0Ig7twG6Rak5jOTeX VoClN8lyjnGdfQAVeL0gcJAXLqNgznGhfmFJh0vSidICC0LvRID1NDR0VrCoJgqY o5zPsO5igrMW+LMNEbD+1AxNCdqNDkkeaX/pELIBmut3fB22ZocPvon0vvhwrEZj xGUzSQ3assSJE+VnA3MqwY2dag5Ui6H/w0iCvvntqhp7PxuHAqH+Zlm3NRBralj5 4UgVh/3cM8GzdAWgznqH9lwZS4QiQuJPDo4Q2SyB2ifMu6bAhseEmfFLGedsZKhw == X-ME-Sender: Received: from [192.168.1.2] (71-35-123-124.tukw.qwest.net [71.35.123.124]) by mail.messagingengine.com (Postfix) with ESMTPA id 8AD7EE4441; Wed, 11 Apr 2018 16:06:55 -0400 (EDT) Subject: Re: Archiving Data to Another DB? To: "Kumar, Virendra" , Don Seiler Cc: "pgsql-general@postgresql.org" References: <2e5cff1cdbbf4a98b4cbc3fac5dbdbff@USDFW11XG20CN01.mercer.com> From: Adrian Klaver Message-ID: <7badeb6b-3330-9f66-8f56-58d11099ac3d@aklaver.com> Date: Wed, 11 Apr 2018 13:06:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <2e5cff1cdbbf4a98b4cbc3fac5dbdbff@USDFW11XG20CN01.mercer.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 04/11/2018 11:59 AM, Kumar, Virendra wrote: > Does this apply to SELECT calls as well or only for DMLs. Easy enough to test: test=# \d projection Foreign table "public.projection" ... Server: fdw_test_server FDW options: (schema_name 'public', table_name 'projection') test=# select count(*) from projection ; count ------- 28430 (1 row) With log_statement = 'all': select * from projection ; postgres-2018-04-11 13:04:33.871 PDT-0LOG: statement: select * from projection ; postgres-2018-04-11 13:04:33.872 PDT-0LOG: statement: START TRANSACTION ISOLATION LEVEL REPEATABLE READ postgres-2018-04-11 13:04:33.872 PDT-0LOG: execute : DECLARE c1 CURSOR FOR SELECT line_id, p_item_no, c_id, method, year, qty, sub_method, proj_note, item_key, pot_ct, trial, ts_insert, ts_update, user_insert, user_update, link_key, v_number FROM public.projection postgres-2018-04-11 13:04:33.872 PDT-0LOG: statement: FETCH 100 FROM c1 postgres-2018-04-11 13:04:33.873 PDT-0LOG: statement: FETCH 100 FROM c1 postgres-2018-04-11 13:04:33.874 PDT-0LOG: statement: FETCH 100 FROM c1 postgres-2018-04-11 13:04:33.875 PDT-0LOG: statement: FETCH 100 FROM c1 postgres-2018-04-11 13:04:33.876 PDT-0LOG: statement: FETCH 100 FROM c1 postgres-2018-04-11 13:04:33.877 PDT-0LOG: statement: FETCH 100 FROM c1 postgres-2018-04-11 13:04:33.878 PDT-0LOG: statement: FETCH 100 FROM c1 postgres-2018-04-11 13:04:33.879 PDT-0LOG: statement: FETCH 100 FROM c1 postgres-2018-04-11 13:04:33.880 PDT-0LOG: statement: FETCH 100 FROM c1 postgres-2018-04-11 13:04:33.881 PDT-0LOG: statement: FETCH 100 FROM c1 postgres-2018-04-11 13:04:33.882 PDT-0LOG: statement: FETCH 100 FROM c1 ... test=# explain analyse select * from projection ; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- Foreign Scan on projection (cost=100.00..115.34 rows=178 width=435) (actual time=0.844..163.493 rows=28430 loops=1) Planning time: 0.077 ms Execution time: 164.735 ms (3 rows) > > I am planning to use postgres_fdw but if it is going by one row at a > time there will be a lot of round trip and defeat the purpose. > > Regards, > > Virendra. > > *From:*Don Seiler [mailto:don@seiler.us] > *Sent:* Wednesday, April 11, 2018 2:53 PM > *To:* Adrian Klaver > *Cc:* pgsql-general@postgresql.org > *Subject:* Re: Archiving Data to Another DB? > > On Wed, Apr 11, 2018 at 1:38 PM, Don Seiler > wrote: > > Yeah, I saw the same with a 132 row insert. Now imagine that with a > monthly 50 million row insert or delete. :p Thanks for the confirmation! > > I went back to look at the postgres logs on my dev server. These logs > are rotated once they hit 2G in size. One typical log from the middle of > my test last night hit that in 13 minutes and had over 5.2 million > DELETE calls. There a quite a few logs like this. That would not be fun > for the disk space on the log volume, either. > > Don. > > -- > > Don Seiler > www.seiler.us > > > ------------------------------------------------------------------------ > > This message is intended only for the use of the addressee and may contain > information that is PRIVILEGED AND CONFIDENTIAL. > > If you are not the intended recipient, you are hereby notified that any > dissemination of this communication is strictly prohibited. If you have > received this communication in error, please erase all copies of the message > and its attachments and notify the sender immediately. Thank you. -- Adrian Klaver adrian.klaver@aklaver.com