Re: Creating big indexes

From: sud <suds1434(at)gmail(dot)com>
To: Lok P <loknath(dot)73(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Creating big indexes
Date: 2024-06-11 18:22:37
Message-ID: CAD=mzVW3jYSYgHVJD0U6vgUnZKongkaszc_Rafv=75usomUUfQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Jun 9, 2024 at 1:40 PM Lok P <loknath(dot)73(at)gmail(dot)com> wrote:

> On Sun, Jun 9, 2024 at 10:39 AM Lok P <loknath(dot)73(at)gmail(dot)com> wrote:
>
>>
>>
>> On Sun, Jun 9, 2024 at 10:36 AM sud <suds1434(at)gmail(dot)com> wrote:
>>
>>>
>>> You can first create the index on the table using the "On ONLY"keyword,
>>> something as below.
>>>
>>> CREATE INDEX idx ON ONLY tab(col1);
>>>
>>> Then create indexes on each partition in "concurrently" from multiple
>>> sessions in chunks.
>>>
>>> CREATE INDEX CONCURRENTLY idx_1 ON tab_part1(col1);
>>> CREATE INDEX CONCURRENTLY idx_2 ON tab_part2(col1);
>>>
>>> After this step finishes the table level index which was created in the
>>> first step will be in valid state automatically.
>>>
>>>
>> Thank you so much.
>> Should we also tweak the parameters related to the parallelism and memory
>> as I mentioned in the first post?
>>
>
> Additionally ,is it also possible to drop the indexes also from the big
> partition table efficiently? To avoid the "transaction id wrap around" or
> "table bloat" when the index drop runs for longer duration?
>
>

I have never tried , but I think you can do "drop index concurrently" from
multiple sessions at same time for each of the partitions to make the drop
index finish quicker, similar to the "create index" statement as mentioned
above. Others may comment.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message veem v 2024-06-11 18:49:55 Re: Does trigger only accept functions?
Previous Message David G. Johnston 2024-06-11 15:29:36 Re: Unexpected Backend PID reported by Notification