Skip to content

INSERTs with executeMany should only emit one INSERT query #82

Description

@jdreaver

Hello!

I noticed today that when I INSERT with executeMany, there are multiple insert queries instead of a single query. SQLite supports lists of values to insert mutliple rows in a single query. For example:

> create table test (a integer, b integer);
> insert into test (a, b) values (1, 2), (3, 4);
> select * from test;
a           b         
----------  ----------
1           2         
3           4 

executeMany does this:

> insert into test (a, b) values (1, 2);
> insert into test (a, b) values (3, 4);

which of course is less efficient than doing it all in one query.

postgresql-simple seems to know about this, so I was surprised to see sqlite-simple emit multiple insert queries.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions