Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzMfg-00081o-Cc for pgsql-general@arkaria.postgresql.org; Tue, 12 Jan 2021 16:37:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kzMff-0004WA-8V for pgsql-general@arkaria.postgresql.org; Tue, 12 Jan 2021 16:37:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzMfe-0004W2-Uj for pgsql-general@lists.postgresql.org; Tue, 12 Jan 2021 16:37:27 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kzMfY-0005Ja-OO for pgsql-general@lists.postgresql.org; Tue, 12 Jan 2021 16:37:26 +0000 Received: by mail-ed1-x529.google.com with SMTP id i24so3008676edj.8 for ; Tue, 12 Jan 2021 08:37:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qudlqouR20loQz8zNAUDAel7y8hoLBKgxWVslVkLw9g=; b=Fbyv7vvnQF0DtgLdkvBgGNw6Ybcrf43BaelHbktf1A6dlPBPT89EiCfAYfAKSPVmtZ Cg0XFNMii/WOHR9VX94RkerOvt1FIg07gUW+/Vlmz29RTLK9uSGKj7WLcgtDXuEYc/Wg zRwep5jeu3lQtPV66cXfAm4Jno25HrFU6xVaVW+n+8EqzJw0uP2nF58ZZFOHUqgp6P9M bSz2907mHqONrX6h2mBT1qHfkg7RD6zcOPvVoiNxMB14LLoEQyO5GAsed+bQ6sc50a+r bsRm93zY2/KroRJcyj6ZZIH/7HD6rA6Nag0rCdKtYgcrleskO/OJugMi2dlFt9lGG3Pi YQFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qudlqouR20loQz8zNAUDAel7y8hoLBKgxWVslVkLw9g=; b=SuLWcUh3YFpxUOChYUdhbuOIV0uKMIgFvZwNlk/k/1HBgPAWyHziHKJau23FPcZLB5 uYoYADZbBlFJ0MMZXQ6QCTb31sfrmg4Em5YAhBeSJBq1UzXbF6rhpsCGYoReJjXoy+ZQ z06PfXAYYAmXOsjfc48Lg8FZYQ85bI47Ckc+i6crRh0nsUcZWlHbdTt2jNT7MMPr/dub hlH10MYqAdYt8nI/sS6O4sFddLl0G1B9a8Vos2/qrt2P3WC73vk/pYz0TmpD6QngIGSa DbC30EnXAWLpRlxZBafA4Glbka2IkNl/ozShiRz/LNPjqj0nRqlHnh68e+xJA2jOFZM4 WZvA== X-Gm-Message-State: AOAM533ZvhDuhZeYUnONg1ze4k35FBXRKSveXMxatrVd4rJNJmWBkTrS vrcbyZINHomypxj4FvTfXr4= X-Google-Smtp-Source: ABdhPJyD84BkQTh2qjshod+KkJgZgmg7hAskbxL/1Rpq5RaUDSYf7RYlipIODwwtLfdmoUw8R3H8Hg== X-Received: by 2002:aa7:c707:: with SMTP id i7mr4067466edq.183.1610469439622; Tue, 12 Jan 2021 08:37:19 -0800 (PST) Received: from hollewijn.internal (217-19-30-105.dsl.cambrium.nl. [217.19.30.105]) by smtp.gmail.com with ESMTPSA id f13sm1398307ejf.42.2021.01.12.08.37.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jan 2021 08:37:18 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: Define hash partition for certain column values From: Alban Hertroys In-Reply-To: <684591610466070@mail.yandex.ru> Date: Tue, 12 Jan 2021 17:37:17 +0100 Cc: Michael Lewis , Tom Lane , "pgsql-general@lists.postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <2278581610342154@mail.yandex.ru> <820805.1610346968@sss.pgh.pa.us> <987221610348608@mail.yandex.ru> <684591610466070@mail.yandex.ru> To: =?utf-8?B?0JPQvtC70YPQsdC10LLQsCDQr9C90LA=?= X-Mailer: Apple Mail (2.3445.104.17) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On 12 Jan 2021, at 16:51, =D0=93=D0=BE=D0=BB=D1=83=D0=B1=D0=B5=D0=B2=D0=B0= =D0=AF=D0=BD=D0=B0 wrote: >=20 > Values for the key partitioning column are generated randomly and I = can't predict their distribution between ranges. > If I just create some ranges I won't have any guarantee that = partitions will have similar amount of data. It is possible that I will = have 2 or 3 extremely big partitions and a bit of data in others. A hash of a random number is also random, so when using hashes for = partitioning you will get the same problem. If you want to distribute values equally over a fixed number of = partitions, I suggest you partition on a modulo of a monotonously = increasing number (a sequence for example), instead of relying on a = random number. > 12.01.2021, 17:55, "Michael Lewis" : > On Tue, Jan 12, 2021 at 1:21 AM =D0=93=D0=BE=D0=BB=D1=83=D0=B1=D0=B5=D0=B2= =D0=B0 =D0=AF=D0=BD=D0=B0 wrote: > List or range partitioning isn't suitable for my case. > I am using a column of numeric(20) type as a base for partitioning. = The values of the column are generated randomly.=20 > So there will be too many partitions if I use list partitioning as is. >=20 > Sorry, but why is range not suited for this? It would seem fairly = trivial to create 50 or 1000 partitions to break up the range of values = allowed by your field definition. Alban Hertroys -- There is always an exception to always.