Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfHXp-0003XJ-Rk for pgsql-performance@arkaria.postgresql.org; Wed, 09 Aug 2017 03:20:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dfHXp-0007gr-EU for pgsql-performance@arkaria.postgresql.org; Wed, 09 Aug 2017 03:20:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dfHXo-0007gc-PP for pgsql-performance@postgresql.org; Wed, 09 Aug 2017 03:20:29 +0000 Received: from mail-sn1nam01on0063.outbound.protection.outlook.com ([104.47.32.63] helo=NAM01-SN1-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dfHXj-0003lb-Om for pgsql-performance@postgresql.org; Wed, 09 Aug 2017 03:20:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NETORG2528281.onmicrosoft.com; s=selector1-laurenthasson-com01i; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ylbJsEUW+FSr0FDS/U8Ajm+CLxVzVuTmJk8fo/Farbk=; b=L/X42c9ZpclDMeIr2cpJ9m71Nle4i+VxW35n0sEZlUkb9D9QuDqjV+xb5zdqCtOcdt3vTVvg5N5Z+jwbweiirj4jBiAEzuFV16YxxhLChBCvLeYRq0N834NWPpMnNkL6ZIW7+yXzrYft79J1si6UAwgn5BEHNJTOoEBmJqAdgUg= Received: from BN4PR15MB0547.namprd15.prod.outlook.com (10.164.61.157) by BN4PR15MB0545.namprd15.prod.outlook.com (10.164.61.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1320.16; Wed, 9 Aug 2017 03:20:20 +0000 Received: from BN4PR15MB0547.namprd15.prod.outlook.com ([10.164.61.157]) by BN4PR15MB0547.namprd15.prod.outlook.com ([10.164.61.157]) with mapi id 15.01.1320.018; Wed, 9 Aug 2017 03:20:19 +0000 From: "ldh@laurent-hasson.com" To: "pgsql-performance@postgresql.org" Subject: Unlogged tables Thread-Topic: Unlogged tables Thread-Index: AQHTELxZLq7x/1InREuLnDINR7olQg== Date: Wed, 9 Aug 2017 03:20:19 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ldh@laurent-hasson.com; x-originating-ip: [12.204.85.2] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BN4PR15MB0545;6:ELRWXB11H2u3TQgY5noZzGB3G3gqdTJg3Qw/QjolwHj92U4roUjC+KJUH07USS1USU8W70y51j11vPu4Z31F3N7HeDafRTFXTLKQCjMD+Yu8Epnbhz4kg0Qa5XR6g4BkacI3xVsmO/Je+sYzvjjF3MNJaa9CzVZ6TwbyaSWNANcwVlkRcfxeNBYmp2VVEflpjaHneiCDORmRbECBWtTJjDyY+VIsGgqD8AGFPPw+NrNsOp7kQ3OeK/YrehsyZZ0QWNG4OdbuzHj71YqzyYpedUZrauB90jU+Z8My8Czy8OAtUlOKMpvQ8ws4QGKnVHRt8wGAyzxKaLil6dk2ykOpfw==;5:mIbsRnTGM3LasBrlEmI6NQpR2BGt8RP4mjvY+k+6mIBFl8VH2RrSjpjDqL7DA9UfbqErUh3aPkqr8SxHwPQ3d4HFK/J00vlaj/dmhFbXnbWcHDI7x4OTY/mpCo8F3CkoVilIn9xu0ioDT0i1duMxrw==;24:8aFAoOo5MiNO9FVfTiB7MolLz1ShsvWfZp9runqZ88QjvlJTlaEF0729eVnljUqikPeMkYizdFTLF+Ik5nHG/JsMcH9IBCpZlNavarMGEG4=;7:V8LJEtHmwba/OMWVqzedTsOlsaufhNI1SsH101UzIfXr9bMxAzJ9QbTIXiy1QkwhWrR0Y/GKoFraWb29Xb1eQTlDrfeEr1mXNgZC1F14b6zown6HWjAS2TAETLm8riuyWDU8GMklj5dOIKzbhiv9EIsq3Q02VRu9u07v6dwzgBefgx1vi4Gl4HWgkfRE+oKhVBkPMOg4Lmksba1YD6KXxYBsN9edcUAZOlCHz84WO5s= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: c41b5007-a1d9-47b1-e8c5-08d4ded59070 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(2017082002075)(300000503095)(300135400095)(2017052603031)(201703131423075)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:BN4PR15MB0545; x-ms-traffictypediagnostic: BN4PR15MB0545: x-exchange-antispam-report-test: UriScan:(158342451672863); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6041248)(20161123560025)(201703131423075)(201703061421075)(20161123564025)(2016111802025)(20161123558100)(20161123555025)(20161123562025)(6043046)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BN4PR15MB0545;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BN4PR15MB0545; x-forefront-prvs: 0394259C80 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(39400400002)(39450400003)(199003)(189002)(86582002)(221733001)(33656002)(508600001)(101416001)(54356999)(50986999)(102836003)(3846002)(6116002)(2900100001)(97736004)(14454004)(25786009)(38730400002)(66066001)(189998001)(2906002)(55016002)(6436002)(6506006)(7736002)(74316002)(99286003)(8676002)(81166006)(2501003)(86362001)(7696004)(3480700004)(8936002)(6606003)(5640700003)(6916009)(81156014)(110136004)(3280700002)(7116003)(3660700001)(68736007)(106356001)(77096006)(9686003)(2351001)(19627405001)(105586002)(5660300001)(54896002)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN4PR15MB0545;H:BN4PR15MB0547.namprd15.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: laurent-hasson.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_BN4PR15MB0547B6736C684F14E4E33BDF858B0BN4PR15MB0547namp_" MIME-Version: 1.0 X-OriginatorOrg: laurent-hasson.com X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Aug 2017 03:20:19.5520 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 7f9c0a0d-79fd-4329-b129-754c4501a177 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN4PR15MB0545 List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org --_000_BN4PR15MB0547B6736C684F14E4E33BDF858B0BN4PR15MB0547namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, We have a fairly large static dataset that we load into Postgres. We made t= he tables UNLOGGED and saw a pretty significant performance improvement for= the loading. This was all fantastic until the server crashed and we were s= urprised to see during a follow up demo that the data had disappeared... Of= course, it's all our fault for not understanding the implications of UNLOG= GED proprely. However, our scenario is truly a set of tables with 100's of millions of ro= ws that are effectively WORMs: we write them once only, and then only read = from them afterwards. As such, they could not be possibly corrupted post-lo= ad (i think) during a server crash (short of physical disk defects...). I'd like to have the performance improvement during a initial batch insert,= and then make sure the table remains after "unclean" shutdowns, which, as = you might have it, includes a regular Windows server shut down during patch= ing for example. So unlogged tables in practice are pretty flimsy. I tried = to ALTER ... SET LOGGED, but that takes a VERY long time and pretty much ne= gates the initial performance boost of loading into an unlogged table. Is there a way to get my cake and eat it too? Thank you, Laurent Hasson --_000_BN4PR15MB0547B6736C684F14E4E33BDF858B0BN4PR15MB0547namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hello,


We have a fairly large static dataset that we load into Postgres. We mad= e the tables UNLOGGED and saw a pretty significant performance improvement = for the loading. This was all fantastic until the server crashed and we wer= e surprised to see during a follow up demo that the data had disappeared... Of course, it's all our fault for= not understanding the implications of UNLOGGED proprely.


However, our scenario is truly a set of tables with 100's of millions of= rows that are effectively WORMs: we write them once only, and then on= ly read from them afterwards. As such, they could not be possibly corrupted= post-load (i think) during a server crash (short of physical disk defects...).


I'd like to have the performance improvement during a initial batch inse= rt, and then make sure the table remains after "unclean" shutdown= s, which, as you might have it, includes a regular Windows server shut down= during patching for example. So unlogged tables in practice are pretty flimsy. I tried to ALTER ... SET LOGGED, but= that takes a VERY long time and pretty much negates the initial performanc= e boost of loading into an unlogged table.


Is there a way to get my cake and eat it too?


Thank you,

Laurent Hasson




--_000_BN4PR15MB0547B6736C684F14E4E33BDF858B0BN4PR15MB0547namp_--