sea-query
sea-query copied to clipboard
postgres: bulk insert API with UNNEST and ARRAYs
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
Just filed a sponsorship to support this.
Thank you for the sponsor. I'd put this on my stack.
Hi. Any updates on this?
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