Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Postgres (+ Redshift) batch exports now async #18501

Closed
wants to merge 42 commits into from

Conversation

tomasfarias
Copy link
Contributor

@tomasfarias tomasfarias commented Nov 9, 2023

Problem

Making PG batch exports async means less blocking the main thread, more concurrent tasks, more performance! Let's do all destinations async and bring down the number of required workers!

Turns out is quite easy to make Postgres batch exports async. What's more, the new COPY API doesn't require a file, so we may try a different buffered approach in the future. I'm very excited for the future of batch exports!

Changes

  • Add psycopg dependency
  • Replace psycopg2 for psycopg everywhere.
  • Sprinkle in async and await.
  • The only user-facing change is that ip and site url are now "" instead of None, but I don't think that's very significant: at least semantically we are not losing or gaining anything as these fields are meant to be deprecated, and in terms of schema both are compatible.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

How did you test this code?

Same tests as before, just now async too.

@tomasfarias tomasfarias changed the title refactor: Postgres batch exports now async refactor: Postgres (+Redshift) batch exports now async Nov 9, 2023
@tomasfarias tomasfarias changed the title refactor: Postgres (+Redshift) batch exports now async refactor: Postgres (+ Redshift) batch exports now async Nov 9, 2023
@tomasfarias tomasfarias force-pushed the refactor/async-postgres-batch-exports branch from 638d5d1 to 194bce8 Compare November 9, 2023 13:46
@tomasfarias tomasfarias force-pushed the refactor/batch-exports-logging-new branch 2 times, most recently from 28ca083 to 403c87d Compare November 10, 2023 14:53
Base automatically changed from refactor/batch-exports-logging-new to master November 13, 2023 15:07
@tomasfarias
Copy link
Contributor Author

Closed in favor of #18631

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant