Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iiYU3-0000Vr-9i for pgsql-admin@arkaria.postgresql.org; Sat, 21 Dec 2019 06:43:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iiYU2-00059e-3w for pgsql-admin@arkaria.postgresql.org; Sat, 21 Dec 2019 06:43:26 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iiYU1-00055p-NV for pgsql-admin@lists.postgresql.org; Sat, 21 Dec 2019 06:43:25 +0000 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iiYTy-0000eQ-UZ for pgsql-admin@lists.postgresql.org; Sat, 21 Dec 2019 06:43:24 +0000 Received: by mail-ot1-x335.google.com with SMTP id k16so10250335otb.2 for ; Fri, 20 Dec 2019 22:43:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=cR9a8Fj/NKg9SJff6wmiv6fw0zq/31SXuT+hWNTreiU=; b=FWjGHhZcThe/KPjmKz6BBrPwrpp4GEF9dz1RO54rFJYdq4cpdJxteBCBAfsE9ZF/3u tWG8UQDBx4b6FylUx+bD3m7g7PbPuxSqYcCpPXm0DdONYoivo/LQspGpHfe6Eyq1ak+J Nl/DeOYexebLe4y5VAhH4TJTX6mm8YXzfA2NrSCEJc1TmtLIne2/FpjLhVcs9huAeJCB arUn0rzHUnqDYZvzNG8JjzGG0LyduHzR6fMhBLdS0ZTTM5MN3icq8nQU8KxbNCz8RPAQ jq7WOReixMCLpGgbvIJKAmnT9ikrEdaswrvTZYViXgRH5qQvYt3W0BeXb6B6Zm1J9go0 4+Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=cR9a8Fj/NKg9SJff6wmiv6fw0zq/31SXuT+hWNTreiU=; b=c3KH13A5LrIGgZGLha1ioL066jY0It+WZABhG5/TX5dtJ/NM0vubdMOGP9VodCRP8v 5g63Rm59UrYIYTgPXsySBUo3K2Hlsc39mpKNjLc+HtpaDxhk6ndki7V44ElkuD1CfmOO EviIgPyz7Ppz8d0wMRoXjNSyvr+KehNYlUBipD7cHKXI4oCwwoxkKbVHIsNmDAcz0Qsp EEFUo6zAjWnJO+FZ4aMlPrlvf5OVbqvCl6GVOafze8bLTLbchAw03Lrn9+OdKOe/r34E YjZf1oEMviCO0TTl2vWNwlAjlRhSNQsmvuBO6MB8q6SopuQdlVfhYXmOOtFWowvbB3NX kyIw== X-Gm-Message-State: APjAAAXP2Frv9X+zpw+EFSbshz2GrCK/dDMLLy0Xnwb5n8jdYrka/dxk 3LbSE0/qlzJNit0I3bRB+bUrslmzkORGfA== X-Google-Smtp-Source: APXvYqw/dBrCUrim3IwvCa1TFKIUINzF8Og5jMSGZzbwIrJ7qqJnmMuGYnWV3IZPN9E/PJK0I9RjCA== X-Received: by 2002:a05:6830:2097:: with SMTP id y23mr3436295otq.286.1576910600880; Fri, 20 Dec 2019 22:43:20 -0800 (PST) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id a17sm4374041otq.49.2019.12.20.22.43.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 22:43:20 -0800 (PST) Subject: Re: Partitioning by month causing an error? To: pgsql-admin@lists.postgresql.org References: <9226.1576897186@sss.pgh.pa.us> <8ba56626-3b91-6ac8-34a9-ab2c9ca2b8c6@gmail.com> <19102.1576901426@sss.pgh.pa.us> <9fe4b503-4be4-4ed5-4299-d7c49c8921b4@gmail.com> <27088.1576904173@sss.pgh.pa.us> From: Ron Message-ID: Date: Sat, 21 Dec 2019 00:43:19 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <27088.1576904173@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------1C8B02B4771138C3D9F8F06B" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------1C8B02B4771138C3D9F8F06B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 12/20/19 10:56 PM, Tom Lane wrote: > Ron writes: >> On 12/20/19 10:10 PM, Tom Lane wrote: >>> This rule breaks fewer things than a rule of A <= X <= B would. >> Why not?  For 20+ years (not on Postgres) I've been specifying partition >> limits where the upper limits are the edge of timestamps (octaword integers >> counting the number of 100ns ticks since November 17, 1858), and have >> *never* had a problem: >> IN ETC_TRAN_DETAIL_201909_UA WITH LIMIT OF '2019-09-30 23:59:59.99', >> IN ETC_TRAN_DETAIL_201910_UA WITH LIMIT OF '2019-10-31 23:59:59.99', > And what happens with '2019-10-31 23:59:59.9999'? The datatype only extends to centiseconds.  Naturally, if it extended to tenths of milliseconds, then I'd have added another two nines to the range limits. > I don't know about > your other database, but in Postgres that value is legal and it's larger > than '2019-10-31 23:59:59.99', but still less than '2019-11-01 00:00:00'. > > The main point here is that even if that works, it requires a whole > lot more assumptions about the behavior of the datatype (specifically, > its precision limit) than the other way. As soon as you look at cases > where the precision limit isn't clearly defined, it just breaks. It works *perfectly* on *discreet* datatypes. Honestly... experience has demonstrated it. Not so much on floats, but I think that's daft anyway. >> Of course, I've also never partitioned a table on a float, thinking that's >> utterly daft. > [ shrug... ] Works fine as long as you have a non-daft partitioning rule. > > regards, tom lane -- Angular momentum makes the world go 'round. --------------1C8B02B4771138C3D9F8F06B Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 12/20/19 10:56 PM, Tom Lane wrote:
Ron <ronljohnsonjr@gmail.com> writes:
On 12/20/19 10:10 PM, Tom Lane wrote:
This rule breaks fewer things than a rule of A <= X <= B would.

      
Why not?  For 20+ years (not on Postgres) I've been specifying partition 
limits where the upper limits are the edge of timestamps (octaword integers 
counting the number of 100ns ticks since November 17, 1858), and have 
*never* had a problem:
IN ETC_TRAN_DETAIL_201909_UA WITH LIMIT OF '2019-09-30 23:59:59.99',
IN ETC_TRAN_DETAIL_201910_UA WITH LIMIT OF '2019-10-31 23:59:59.99',
And what happens with '2019-10-31 23:59:59.9999'? 

The datatype only extends to centiseconds.  Naturally, if it extended to tenths of milliseconds, then I'd have added another two nines to the range limits.

 I don't know about
your other database, but in Postgres that value is legal and it's larger
than '2019-10-31 23:59:59.99', but still less than '2019-11-01 00:00:00'.

The main point here is that even if that works, it requires a whole
lot more assumptions about the behavior of the datatype (specifically,
its precision limit) than the other way.  As soon as you look at cases
where the precision limit isn't clearly defined, it just breaks.

It works perfectly on discreet datatypes.  Honestly... experience has demonstrated it.

Not so much on floats, but I think that's daft anyway.

Of course, I've also never partitioned a table on a float, thinking that's 
utterly daft.
[ shrug... ]  Works fine as long as you have a non-daft partitioning rule.

			regards, tom lane

--
Angular momentum makes the world go 'round.
--------------1C8B02B4771138C3D9F8F06B--