Re: Partition with check constraint with "like"
От | David Rowley |
---|---|
Тема | Re: Partition with check constraint with "like" |
Дата | |
Msg-id | CAApHDvqFJ=ZCeo2fEcxq32gM+CN3PBNphB0PG4TT+dwon3XWqw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Partition with check constraint with "like" (Nagaraj Raj <nagaraj.sf@yahoo.com>) |
Список | pgsql-performance |
On Sat, 22 May 2021 at 04:38, Nagaraj Raj <nagaraj.sf@yahoo.com> 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 thename column. name column has a combination of alpha numeric values. Going by the description of your use case, I think HASH partitioning might be a better option for you. It'll certainly be less painful to initially set up and maintain. Here's an example: create table mytable (a text) partition by hash(a); create table mytable0 partition of mytable for values with(modulus 10, remainder 0); create table mytable1 partition of mytable for values with(modulus 10, remainder 1); create table mytable2 partition of mytable for values with(modulus 10, remainder 2); --etc Change the modulus to the number of partitions you want and ensure you create a partition for each modulus. In this case, it would be 0 to 9. David
В списке pgsql-performance по дате отправления: