Skip to content

Question: Multi-insert statement #530

@espringe

Description

@espringe

Postgres supports something like:
INSERT INTO foo(a,b) VALUES (q,r), (s,t) ...

How can I do this in node-postgres? Right now I'm using a transaction, and async.parallelLimit for individual INSERTs. But this seems rather inefficient, and it's as I need it for a reasonably high-volume log -- where every few seconds I need to insert quite a bit of data -- performance matters.

So I'm wondering if there's a better way. (And I happy to string concat my own query, but I don't an escaping function exposed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions