RE: Partition with check constraint with "like"

2021-05-21 Thread Michel SALAIS
;); It should be create table mytable_z of mytable for values from ('Z') to ('[') Michel SALAIS De : Nagaraj Raj mailto:nagaraj...@yahoo.com> > Envoyé : vendredi 21 mai 2021 18:39 À : David Rowley mailto:dgrowle...@gmail.com> > Cc : Justin Pryzby mailto:pry.

Re: Partition with check constraint with "like"

2021-05-21 Thread David Rowley
On Sat, 22 May 2021 at 10:59, Nagaraj Raj wrote: > ERROR: empty range bound specified for partition "mytable_z" DETAIL: > Specified lower bound ('Z') is greater than or equal to upper bound ('['). > SQL state: 42P17 It looks like '[' does not come after 'Z' in your collation. David

Re: Partition with check constraint with "like"

2021-05-21 Thread David Rowley
On Sat, 22 May 2021 at 04:38, Nagaraj Raj wrote: > I am trying to create partitions on the 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 trying to create a partition-based first > letter of the n

Re: Partition with check constraint with "like"

2021-05-21 Thread Nagaraj Raj
: 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   De : Nagaraj Raj Envoyé : vendredi 21 mai 2021 18:39 À : David Rowley Cc : Jus

Re: Partition with check constraint with "like"

2021-05-21 Thread Nagaraj Raj
ct: 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   De : Nagaraj Raj Envoyé : vendredi 21 mai 2021 18:39 À : David Rowley Cc :

RE: Partition with check constraint with "like"

2021-05-21 Thread Michel SALAIS
aj Envoyé : vendredi 21 mai 2021 18:39 À : David Rowley Cc : Justin Pryzby ; Pgsql-performance Objet : Re: Partition with check constraint with "like" Hi David, Hi, I am trying to create partitions on the table which have around 2BIL records and users will always

Re: Partition with check constraint with "like"

2021-05-21 Thread Nagaraj Raj
> select * from t1 where name = somename ?  == equality match  // if yes, hash > partitioning may be helpful to a have reasonably balanced distribution yes, its an equality check,  On Friday, May 21, 2021, 12:08:25 PM PDT, Vijaykumar Jain wrote: just out of curiosity,what would a typ

Re: Partition with check constraint with "like"

2021-05-21 Thread Vijaykumar Jain
just out of curiosity, what would a typical query be ? select * from t1 where name = somename ? == equality match // if yes, hash partitioning may be helpful to a have reasonably balanced distribution or select * from t1 where name like 'some%'; what would be the distribution of rows for

Re: Partition with check constraint with "like"

2021-05-21 Thread Nagaraj Raj
Hi David, Hi, I am trying to create partitions on the 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 trying to create a partition-based first letter of the name column. name column has a combination o

Re: Partition with check constraint with "like"

2021-05-21 Thread David Rowley
On Fri, 21 May 2021 at 19:02, Nagaraj Raj wrote: > then what would be the range of Z > FROM (Z) to (?) ; postgres=# select chr(ascii('z')+1) ; chr - { (1 row) > same way for 9 postgres=# select chr(ascii('9')+1) ; chr - : (1 row) https://en.wikipedia.org/wiki/ASCII You can also u

Re: Partition with check constraint with "like"

2021-05-21 Thread Nagaraj Raj
So what about 'Z' or 'z' and 9? I created the partitions tables FROM (A) to (B) ;FROM (B) to (C) ; .. FROM (Y) to (Z) ; then what would be the range of ZFROM (Z) to (?) ;  same way for 9 On Thursday, May 20, 2021, 07:38:50 PM PDT, Justin Pryzby wrote: On Fri, May 21, 2021 at 02:36:14AM

Re: Partition with check constraint with "like"

2021-05-20 Thread Michael Lewis
On Thu, May 20, 2021, 8:38 PM Justin Pryzby wrote: > On Fri, May 21, 2021 at 02:36:14AM +, Nagaraj Raj wrote: > > Thank you. This is a great help. > > But "a" have some records with alpha and numeric. > > So then you should make one or more partitions FROM ('1')TO('9'). > What about 0? Sorr

Re: Partition with check constraint with "like"

2021-05-20 Thread Justin Pryzby
On Fri, May 21, 2021 at 02:36:14AM +, Nagaraj Raj wrote: > Thank you. This is a great help.  > But "a" have some records with alpha and numeric.  So then you should make one or more partitions FROM ('1')TO('9'). > example : > insert into mytable values('alpha'),('bravo'); > insert into mytab

Re: Partition with check constraint with "like"

2021-05-20 Thread Nagaraj Raj
Thank you. This is a great help.  But "a" have some records with alpha and numeric.  example : insert into mytable values('alpha'),('bravo'); insert into mytable values('1lpha'),('2ravo'); On Thursday, May 20, 2021, 06:23:14 PM PDT, David Rowley wrote: On Fri, 21 May 2021 at 12:32, Na

Re: Partition with check constraint with "like"

2021-05-20 Thread David Rowley
On Fri, 21 May 2021 at 12:32, Nagaraj Raj wrote: > I am trying to create partitions on the table based on first letter of the > column record value using inherit relation & check constraint. You'll get much better performance out of native partitioning than you will with the old inheritance met