Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpn0I-0003rV-Vs for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Sep 2017 02:57:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dpn0H-0006Vj-Kn for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Sep 2017 02:57:17 +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 1dpmyj-0003oI-Mm for pgsql-hackers@postgresql.org; Thu, 07 Sep 2017 02:55:41 +0000 Received: from bay.acenet.us ([173.230.252.50]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dpmye-0001jy-CJ for pgsql-hackers@postgresql.org; Thu, 07 Sep 2017 02:55:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=K61zB0rl4u4c2EIM2IAjw581ICjxXhMpJEtkyAE+PdE=; b=NMMoFJ3TQVnx8MGj1cgZ6iNYAs cwnan+PMv9UcVYNVqThg3Ii6gHg5ZGLu8nSQUcnDZfiewMCSj+mUvTjblKWMUiIACz8Y9s1iuzD3U SJHjabXgZQo8WwO8Ah5o4JmtAgys+/j6h+6AVadUU8VuPx+6drBHDGPJDNsBuqFbkmZ0t5SBXjqUa fg+eIEBAxgeaEJColJ56L7G6a7hnVeVV2x4CAYBJLGxSbc2xdtj0+OyNUR259WfBH2HHZLbWd7s34 BuJxvvvhIJASL8jckIDb5xDrXt3770U92HTPHGcPzZa1AI3zrwG7M5d5Dlo4wYFuhCdxR+t0vNivx DI9vguHg==; Received: from [50.102.16.86] (port=59410) by bay.acenet.us with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) (envelope-from ) id 1dpmyV-001B0k-HP; Wed, 06 Sep 2017 22:55:32 -0400 Subject: Re: Replication vs. float timestamps is a disaster To: Omar Kilani , Andres Freund References: <1691.1487519369@sss.pgh.pa.us> <20170220070311.gscn7ppqbwlgdpjq@alap3.anarazel.de> <3bd3c551-8b23-45c8-27a2-97b5a922b130@2ndquadrant.com> <20170220110456.2jupmfhxlizykmmc@alap3.anarazel.de> <20170222075345.mbzrmdaetdqfgitk@alap3.anarazel.de> <21041.1487771008@sss.pgh.pa.us> <20170222135634.gnlqu6by2xbpvwii@alap3.anarazel.de> <21225.1487803552@sss.pgh.pa.us> <8f819ff5-0162-f382-72d1-da565ceb4125@commandprompt.com> <20170228011332.afd5x35pftvwkxbd@alap3.anarazel.de> Cc: "Joshua D. Drake" , Tom Lane , Jim Nasby , Petr Jelinek , Robert Haas , "pgsql-hackers@postgresql.org" From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <59B0B51E.5020406@anastigmatix.net> Date: Wed, 6 Sep 2017 22:55:26 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-95.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap+anastigmatix.net/only user confirmed/virtual account not confirmed X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 09/06/17 18:33, Omar Kilani wrote: > Is there anything people using float datetimes can do that isn't a > pg_dumpall | pg_restore to do a less painful update? > > We have several TB of data still using float datetimes and I'm trying > to figure out how we can move to 10 (currently on 9.6.x) without > massive amounts of $ in duplicated hardware or downtime. I ran into an analogous issue with endianness of PL/Java-defined datatypes, and ended up devising a procedure [1] for treating the type one way on output and another way on input, and then constructing an UPDATE query that just assigns the column to itself using a function that's essentially identity, but forces the output-input conversion (and doesn't look like a simple identity function to the query optimizer, which otherwise might optimize the whole update away). While the details of that were specific to PL/Java and byte order, something similar might work in your case if you can afford some period, either just before or just after migration, when your normal workload is blocked, long enough to run such updates on your several TB of data. Or if that's too big a chunk of downtime, you might be able to add a column in advance, of some user-defined type the same width as an integer datetime, populate that in advance, migrate, then do a quick catalog switcheroo of the column names and types. I've never done that, so someone else might have comments on its feasibility or the best way of doing it. > the exact crash, but the datetime values were either too small or too > large to fit into the integer datetimes field -- I can retry this if That does seem important to get the details on. If the integer datetime column won't represent your stuff (and the too-large or too-small values are necessary to represent), then some schema change might be necessary. Or, if the outlying values were sentinel values of some kind (I wonder, how else would you even have datetimes outside of the int64 range?), maybe they can be replaced with others that fit. -Chap [1]: https://tada.github.io/pljava/use/byteordermigrate.html -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers