Sankar P <sankar(dot)curiosity(at)gmail(dot)com> writes:
> I spoke too soon. While this worked fine when there were no indexes
> and finished within 10 minutes, with GIN index on the jsonb column, it
> is taking hours and still not completing.
There's the generic advice that building an index after-the-fact
is often cheaper than updating it incrementally. For GIN indexes
specifically, see also
https://www.postgresql.org/docs/current/gin-tips.html
regards, tom lane