sea-query icon indicating copy to clipboard operation
sea-query copied to clipboard

postgres: bulk insert API with UNNEST and ARRAYs

Open gitmalong opened this issue 2 years ago • 5 comments

Relates to:

  • https://github.com/SeaQL/sea-orm/discussions/710#discussioncomment-7319840
  • https://github.com/SeaQL/sea-orm/issues/1922

Basically I would like to let SeaQuery build a Postgres bulk insert query in the following format:

insert into table(a, b) 
values(1, unnest(array[1, 2, 3]))

Benefits:

  • Avoids parameter count limitation as the the inserted values are an array
  • In general a smaller query before replacing placeholders
  • When working with batch data the current limitation leads to performance bottlenecks as one has to split huge batch inserts into smaller chunks to avoid running in the parameter count limit so this is really not just cosmetic

gitmalong avatar Dec 17 '23 02:12 gitmalong

Just filed a sponsorship to support this.

gitmalong avatar Dec 25 '23 07:12 gitmalong

Thank you for the sponsor. I'd put this on my stack.

tyt2y3 avatar Dec 27 '23 22:12 tyt2y3

Hi. Any updates on this?

gitmalong avatar May 30 '24 09:05 gitmalong

Sorry for the delay. Yes, we have some time now as 1.0 is concluding. I have some plan regarding OLAP, including bulk data inserts and some extensions to TimescaleDB

tyt2y3 avatar May 30 '24 11:05 tyt2y3