Skip to content

Upset best practice? #420

Closed
Closed

Description

@Jflick58

Hi,

I'm currently upserting around 2.5 million rows to Postgres. I replaced my previous use of Sqlalchemy + psycopg2 with Asyncpg, but I'm not seeing the performance gains I expected. I have a complex query statement that utilizes ON CONFLICT to upset. SQLalchemy has an ORM method for this, but I don't see anything equivalent in the Asyncpg docs. I currently use executemany and pass a list of tuples that were converted from a Pandas data frame. I don't think I would be able to perform my upset function using copy_records_to_table, can you advise on how to approach this with Asyncpg?

Activity

  1. elprans commented on Mar 22, 2019

    @elprans
    Member

    #295 should boost the executemany() manyfold. I'll try to find time to get it merged soon.

  2. pkeeper commented on Jul 19, 2019

    @pkeeper

    Please do.
    We've chosen asyncpg for it's performance, and we have a lot of upserts, that are working hacky now.

  3. elprans commented on Nov 26, 2020

    @elprans
    Member

    #295 has been merged, executemany performance should be much better in the next release.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions