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 1lkEZR-0002IR-Tv for pgsql-performance@arkaria.postgresql.org; Fri, 21 May 2021 23:28:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lkEZO-0007Rf-G4 for pgsql-performance@arkaria.postgresql.org; Fri, 21 May 2021 23:28:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lkEZN-0007Qs-US for pgsql-performance@lists.postgresql.org; Fri, 21 May 2021 23:28:42 +0000 Received: from sonic311-25.consmr.mail.ne1.yahoo.com ([66.163.188.206]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lkEZF-0001eb-Ta for pgsql-performance@postgresql.org; Fri, 21 May 2021 23:28:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1621639712; bh=c9yU6pFahNlAFgBdujAOcBP/ygJdpi09mMs+Uinbw6k=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject:Reply-To; b=lsuxw2VPKLhtuXnsf3PGYZ9eh3T200dP2FRXFMOOXxboh+0mnRelivCLFiymQGoQNi5Mf6ob8b2mW+YNHhmjnCfINLllzrmcOVr6d1922lKo4ZHWtS+dOkQQDgcrHKLdOLWWWNHwR1lnObHifEiNLXy0HdRGfA/bt4fLkoP9aP/4rpYp5AqtaYd+fPtTt0hC2QT4gz9TsUIvZn1SGyhhe9G+37AzVJAB2gf3KulMjdNRr7rCH0T01O6Q5dubWwjaVep0oKrr1l6c1WhAEpT7PvOmqNUglDEjfDkCR49TCsxfu3hl77Dn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vInGCSli6qllYiODFM7egKARc9gPc_iNWIVc- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ne1.yahoo.com with HTTP; Fri, 21 May 2021 23:28:32 +0000 Date: Fri, 21 May 2021 23:28:28 +0000 (UTC) From: Nagaraj Raj To: 'David Rowley' , Michel SALAIS Cc: 'Justin Pryzby' , 'Pgsql-performance' , Michael Lewis Message-ID: <1954965228.496968.1621639708945@mail.yahoo.com> In-Reply-To: <2032281808.469685.1621637941028@mail.yahoo.com> References: <87840670.92362.1621557131080.ref@mail.yahoo.com> <87840670.92362.1621557131080@mail.yahoo.com> <1347719485.144821.1621564574978@mail.yahoo.com> <20210521023836.GH3676@telsasoft.com> <81358482.168153.1621580571840@mail.yahoo.com> <2126516115.347941.1621615110621@mail.yahoo.com> <005201d74e84$4ee9be30$ecbd3a90$@msym.fr> <2032281808.469685.1621637941028@mail.yahoo.com> Subject: Re: Partition with check constraint with "like" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_496967_582797703.1621639708941" X-Mailer: WebService/1.1.18368 YMailNorrin Content-Length: 20404 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------=_Part_496967_582797703.1621639708941 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable sorry, forgot to attach the test cases.Postgres 13 | db<>fiddle |=20 |=20 | |=20 Postgres 13 | db<>fiddle Free online SQL environment for experimenting and sharing. | | | On Friday, May 21, 2021, 03:59:18 PM PDT, Nagaraj Raj wrote: =20 =20 Hi,=C2=A0 This is also not working, create table mytable_z partition of mytable for values from ('Z') to ('[')p= artition by range(id); ERROR: empty range bound specified for partition "mytable_z"DETAIL: Specifi= ed lower bound ('Z') is greater than or equal to upper bound ('[').SQL stat= e: 42P17 DB running on version PostgreSQL 11.6, compiled by Visual C++ build 1800, 6= 4-bit On Friday, May 21, 2021, 02:00:38 PM PDT, Michel SALAIS wrote: =20 =20 #yiv1392522220 -- filtered {}#yiv1392522220 filtered {}#yiv1392522220 filt= ered {}#yiv1392522220 filtered {}#yiv1392522220 filtered {}#yiv1392522220 p= .yiv1392522220MsoNormal, #yiv1392522220 li.yiv1392522220MsoNormal, #yiv1392= 522220 div.yiv1392522220MsoNormal {margin:0cm;font-size:11.0pt;font-family:= sans-serif;}#yiv1392522220 a:link, #yiv1392522220 span.yiv1392522220MsoHype= rlink {color:blue;text-decoration:underline;}#yiv1392522220 span.yiv1392522= 220EmailStyle20 {font-family:sans-serif;color:windowtext;}#yiv1392522220 .y= iv1392522220MsoChpDefault {font-size:10.0pt;}#yiv1392522220 filtered {}#yiv= 1392522220 div.yiv1392522220WordSection1 {}#yiv1392522220=20 Hi I don=E2=80=99t =C2=A0discuss here the choice itself but this is not correc= t: create table mytable_z of mytable=C2=A0 for values from ('Z') to ('Z['); =C2=A0 It should be create table mytable_z of mytable=C2=A0 for values from ('Z') to ('[') =C2=A0 Michel SALAIS =C2=A0 De=C2=A0: Nagaraj Raj =20 Envoy=C3=A9=C2=A0: vendredi 21 mai 2021 18:39 =C3=80=C2=A0: David Rowley Cc=C2=A0: Justin Pryzby ; Pgsql-performance Objet=C2=A0: Re: Partition with check constraint with "like" =C2=A0 Hi David, =C2=A0 Hi, =C2=A0 I am trying to create partitions on the table which have around 2BIL record= s and users will always look for the "name", its not possible to create a p= artition with a list, so we are trying to create a partition-based first le= tter of the name column. name column has a combination of alpha numeric val= ues. =C2=A0 =C2=A0 =C2=A0 > postgres=3D# select chr(ascii('z')+1) ; > chr > ----- > { > (1 row) =C2=A0 I tried as below, I'm able to create a partition table for 'Z', but it's no= t identifying partition table.=C2=A0 =C2=A0 =C2=A0 postgres=3D# select chr(ascii('Z')+1) ; chr ----- [ (1 row) =C2=A0 create table mytable_z of mytable=C2=A0 for values from ('Z') to ('Z['); CREATE TABLE=C2=A0 =C2=A0 insert into mytable=C2=A0 values(4,'ZAR83NB'); =C2=A0 ERROR: no partition of relation "mytable" found for row DETAIL: Partition k= ey of the failing row contains (name) =3D (ZAR83NB). SQL state: 23514 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 On Friday, May 21, 2021, 01:24:13 AM PDT, David Rowley wrote:=20 =C2=A0 =C2=A0 On Fri, 21 May 2021 at 19:02, Nagaraj Raj wrote: > then what would be the range of Z > FROM (Z) to (?) ; postgres=3D# select chr(ascii('z')+1) ; chr ----- { (1 row) > same way for 9 postgres=3D# select chr(ascii('9')+1) ; chr ----- : (1 row) https://en.wikipedia.org/wiki/ASCII You can also use MINVALUE and MAXVALUE to mean unbounded at either end of the range. But is there a particular need that you want to partition this way? It seems like it might be a bit painful to maintain, especially if you're not limiting yourself to ASCII or ANSI characters. You might want to consider HASH partitioning if you're just looking for a way to keep your tables and indexes to a more manageable size. You've not really mentioned your use case here, so it's hard to give any advice. There are more details about partitioning in https://www.postgresql.org/docs/current/ddl-partitioning.html David =20 ------=_Part_496967_582797703.1621639708941 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =20
=20
On Friday, May 21, 2021, 03:59:18 PM PDT, Nagaraj Raj &= lt;nagaraj.sf@yahoo.com> wrote:


Hi, 

This is also not working,

create table mytable_z partition of mytable for values from= ('Z') to ('[')
partition by range(id);


= E= RROR: empty range bound specified for partition "mytable_z" DETAIL: Specified lower bound ('Z') is greater than or equal to upper boun= d ('['). SQL state: 42P17


DB running on version PostgreSQL 11.6= , compiled by Visual C++ build 1800, 64-bit

=20
=20
On Friday, May 21, 2021, 02:00:38 PM PDT, Michel SALAIS= <msalais@msym.fr> wrote:


Hi

I don=E2=80=99t  = discuss here the choice itself but this is not correct:

create table mytable_z of mytable  for values from ('Z') to ('Z[');

 

It= should be

create table mytable_= z of mytable  for values from ('Z'= ) to ('[')

 

Michel SALAIS<= /p>

 

D= e : Nagaraj Raj <nagaraj.sf@yahoo.com>
Envoy=C3=A9 : vendredi 21 mai 2021 18:39
=C3= =80 : David Rowley <dgrowleyml@gmail.com>
= Cc : Justin Pryzby <pryzby@telsasoft.com>; Pgsql-performa= nce <pgsql-performance@postgresql.org>
Objet&nbs= p;: Re: Partition with check constraint with "like"

 

Hi David= ,

 

=

Hi,

 

I am trying to create partitions on t= he table which have around 2BIL records and users will always look for the = "name", its not possible to create a partition with a list, so we are tryin= g to create a partition-based first letter of the name column. name column = has a combination of alpha numeric values.

 

 

 

> postgres=3D# select chr(ascii('z')+1) ;
> chr<= br clear=3D"none">> -----
> {
>= ; (1 row)

 

I tried as below, I'm able to create a partition table= for 'Z', but it's not identifying partition table. 

<= div>

 

 = ;

postgres=3D# select chr(ascii= ('Z')+1) ;
chr
-----
= [
(1 row)

 =

create table mytable_z o= f mytable  for values from ('Z') t= o ('Z[');

CREATE TABLE <= /p>

 

insert into mytable  values(4,= 'ZAR83NB');

 

=

ERROR: no partition o= f relation "mytable" found for row DETAIL: Partition key of the failing row= contains (name) =3D (ZAR83NB). SQL state: 23514

&n= bsp;

 

=

 

 

 

On Friday, May 21, 2021, 01:24:13 AM PDT, David Rowley <dgrowl= eyml@gmail.com> wrote:

 

<= span style=3D"font-size:10.0pt;font-family:sans-serif;color:#26282A;"> &nbs= p;

On Fri, 21 May= 2021 at 19:02, Nagaraj Raj <nagaraj.sf@yahoo.com> wrote:
> then what would be the range of Z
> F= ROM (Z) to (?) ;

postgres=3D# select c= hr(ascii('z')+1) ;
chr
-----
{
(1 row)

=
> same way for 9

postgres=3D# select chr(ascii('9')+1) ;
chr
-----
:
(1 row)

https://en.w= ikipedia.org/wiki/ASCII

You can al= so use MINVALUE and MAXVALUE to mean unbounded at either end
of the range.

But is there a parti= cular need that you want to partition this way? It
seems = like it might be a bit painful to maintain, especially if you're
not limiting yourself to ASCII or ANSI characters.

You might want to consider HASH partitioning if you'= re just looking
for a way to keep your tables and indexes= to a more manageable size.
You've not really mentioned y= our use case here, so it's hard to give
any advice.

There are more details about partitioning i= n
https://www.postgresql.org/docs/current/ddl-partitioning.html=



David

=
------=_Part_496967_582797703.1621639708941--