Re: Insert with Jsonb column hangs

2024-03-09 Thread Rob Sargent
> On Mar 9, 2024, at 9:01 AM, kuldeep singh wrote: > >  > Copy may not work in our scenario since we need to join data from multiple > tables & then convert it to json using row_to_json . This json data > eventually needs to be stored in a target table . >> Wait. You're getting the

Re: Insert with Jsonb column hangs

2024-03-09 Thread kuldeep singh
Thanks Adrian & Hector . I will try the copy approach & post the result here. On Sat, Mar 9, 2024 at 9:57 PM hector vass wrote: > > > On Sat, Mar 9, 2024 at 4:10 PM Adrian Klaver > wrote: > >> On 3/9/24 08:00, kuldeep singh wrote: >> > Copy may not work in our scenario since we need to join

Re: Insert with Jsonb column hangs

2024-03-09 Thread hector vass
On Sat, Mar 9, 2024 at 4:10 PM Adrian Klaver wrote: > On 3/9/24 08:00, kuldeep singh wrote: > > Copy may not work in our scenario since we need to join data from > > multiple tables & then convert it to json using row_to_json . This > > json data eventually needs to be stored in a target

Re: Insert with Jsonb column hangs

2024-03-09 Thread hector vass
copy syntax can include any valid select statement COPY (any valid select statement joining tables and converting it row_to_json) TO 'some_dump_file' or can copy a view CREATE VIEW myview (any valid select statement joining tables and converting it row_to_json); COPY myview TO

Re: Insert with Jsonb column hangs

2024-03-09 Thread Adrian Klaver
On 3/9/24 08:00, kuldeep singh wrote: Copy may not work in our scenario since we need to join data from multiple tables & then  convert it to json using  row_to_json . This json data eventually  needs to be stored in a target table . Per: https://www.postgresql.org/docs/current/sql-copy.html

Re: Insert with Jsonb column hangs

2024-03-09 Thread kuldeep singh
Copy may not work in our scenario since we need to join data from multiple tables & then convert it to json using row_to_json . This json data eventually needs to be stored in a target table . Will it be better if we break the process into batches of like 10,000 rows & insert the data in its

Re: Insert with Jsonb column hangs

2024-03-09 Thread hector vass
On Sat, Mar 9, 2024 at 3:02 PM kuldeep singh wrote: > Hi, > > We are inserting data close to 1M record & having a single Jsonb column > but query is getting stuck. > > We are using insert into select * .. , so all the operations are within > the DB. > > If we are running select query

Insert with Jsonb column hangs

2024-03-09 Thread kuldeep singh
Hi, We are inserting data close to 1M record & having a single Jsonb column but query is getting stuck. We are using insert into select * .. , so all the operations are within the DB. If we are running select query individually then it is returning the data in 40 sec for all rows but with