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 1iiWQY-0003L2-TZ for pgsql-admin@arkaria.postgresql.org; Sat, 21 Dec 2019 04:31:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iiWQX-0004xN-CW for pgsql-admin@arkaria.postgresql.org; Sat, 21 Dec 2019 04:31:41 +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 1iiWQX-0004xG-0r for pgsql-admin@lists.postgresql.org; Sat, 21 Dec 2019 04:31:41 +0000 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iiWQU-00083m-RV for pgsql-admin@lists.postgresql.org; Sat, 21 Dec 2019 04:31:40 +0000 Received: by mail-ot1-x32b.google.com with SMTP id p8so14527092oth.10 for ; Fri, 20 Dec 2019 20:31:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:cc:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=8Mox2F25Xs+FRvM2a7DB8HvSZEOgOmYQnP37oD8fars=; b=BVlyVq7c6SKyXnTjJync4LhVENDG0QvE0HFRahC4D/gD1n5QwgSRMheHddnypIVBlY QriyD/Kz1alvb52p28kwa8Nu2680ydVwJBZYFU3Vb+Q9MAgoirg/w3jeSNAUHvBi6RI6 lH2uNzo39lNyVs1BTsqLf0p4l8oAxQzwLIWx0GGEOBY586lzwU4AsnDVpKxv3x7CigQK 9F0k7RH2Mmxxs9XCM4MGxnmIAzllv/iHugu9YxF0tBsN+SFcHEJ1ljJK5XpyyJxwnSQF xAFbvVne7BsyERtAsC/mW9H8KiPq0Z5LTcDY6Xd2QDeKGTD2/Jpcin93vQyv+6vw5Bmi K4yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=8Mox2F25Xs+FRvM2a7DB8HvSZEOgOmYQnP37oD8fars=; b=X9K98bbEkfvP0pdQpLX6+cAMzIgbawwjh1kDP3ZZ7Ix3TP+yA/GYRo338Cv8V+le8e PpuuUAijr9Dxbu2FvYJKAl04iR/ngJXDww1VdtFE3e9WClkz9lwr9TUMZ4PT+Afps5lz zdGgNnhMkmIKgWO20ofZijR7MpE0PoTb8uwjz48DpEyKTMXPbL2TSqrFIS/UIz9I4C9J N56b2nmTaTGL/qLgu2lDtzTqMxfBR3w5vNt3nXbQ5aQed6w1NY4yA9JwRwZjAgHTUPsL SIy01xeoq6UtGAjRmdCm07YefvlYtUYglkNo7nt7z25jni3vocCKV9Q9s2PAw2FZr/mC t5Ug== X-Gm-Message-State: APjAAAXYsUUFuB/VMz8u5QnKqK0LiaVEEZ9X+0KVQ0kzOvZKTI5PGqXw n/oJKd1dbQ2LRmLRcP2KLrwjvWml61YZlw== X-Google-Smtp-Source: APXvYqwuUQ27nc/CiN4M3O6W0VAcw36+3n21MWA7MdFV0dRh7qdOpN1CGRV8A+t3P1JcBgqnZb12CQ== X-Received: by 2002:a05:6830:1d5b:: with SMTP id p27mr1523026oth.263.1576902696502; Fri, 20 Dec 2019 20:31:36 -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 c12sm2699311otp.9.2019.12.20.20.31.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 20:31:35 -0800 (PST) Subject: Re: Partitioning by month causing an error? Cc: 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> From: Ron Message-ID: <9fe4b503-4be4-4ed5-4299-d7c49c8921b4@gmail.com> Date: Fri, 20 Dec 2019 22:31:35 -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: <19102.1576901426@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------B25D12BABC7E71286F45551B" 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. --------------B25D12BABC7E71286F45551B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 12/20/19 10:10 PM, Tom Lane wrote: > Ron writes: >> On 12/20/19 8:59 PM, Tom Lane wrote: >>> The rule is that a range partition from A to B covers values A <= X < B. >> If I were to ask to count *from* 1 *to* 100, you'd count from 1 to 100, >> *not* 1 to 99.  Who decided to arbitrarily break a grammatical rule we >> (native English speakers, and I bet everyone else, too) all learn as >> children, causing all sorts of needless confusion and breakage? > This rule breaks fewer things than a rule of A <= X <= B would. In > particular, for more-or-less-continuous values like float8s or timestamps, > you really really don't want to have to write down > the-last-possible-value-before-the-start-of-the-next-partition. 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', IN ETC_TRAN_DETAIL_201911_UA WITH LIMIT OF '2019-11-30 23:59:59.99', IN ETC_TRAN_DETAIL_201912_UA WITH LIMIT OF '2019-12-31 23:59:59.99', IN ETC_TRAN_DETAIL_202001_UA WITH LIMIT OF '2020-01-31 23:59:59.99', IN ETC_TRAN_DETAIL_202002_UA WITH LIMIT OF '2020-02-28 23:59:59.99', etc, etc, etc Of course, I've also never partitioned a table on a float, thinking that's utterly daft. -- Angular momentum makes the world go 'round. --------------B25D12BABC7E71286F45551B Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 12/20/19 10:10 PM, Tom Lane wrote:
Ron <ronljohnsonjr@gmail.com> writes:
On 12/20/19 8:59 PM, Tom Lane wrote:
The rule is that a range partition from A to B covers values A <= X < B.

      
If I were to ask to count *from* 1 *to* 100, you'd count from 1 to 100, 
*not* 1 to 99.  Who decided to arbitrarily break a grammatical rule we 
(native English speakers, and I bet everyone else, too) all learn as 
children, causing all sorts of needless confusion and breakage?
This rule breaks fewer things than a rule of A <= X <= B would.  In
particular, for more-or-less-continuous values like float8s or timestamps,
you really really don't want to have to write down
the-last-possible-value-before-the-start-of-the-next-partition.

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',
IN ETC_TRAN_DETAIL_201911_UA WITH LIMIT OF '2019-11-30 23:59:59.99',
IN ETC_TRAN_DETAIL_201912_UA WITH LIMIT OF '2019-12-31 23:59:59.99',
IN ETC_TRAN_DETAIL_202001_UA WITH LIMIT OF '2020-01-31 23:59:59.99',
IN ETC_TRAN_DETAIL_202002_UA WITH LIMIT OF '2020-02-28 23:59:59.99',
etc, etc, etc

Of course, I've also never partitioned a table on a float, thinking that's utterly daft.


--
Angular momentum makes the world go 'round.
--------------B25D12BABC7E71286F45551B--