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

Proposal for Read-Only transactions support in Pgloader for PostgreSQL sources #1601

Open
alexispires opened this issue Aug 7, 2024 · 1 comment

Comments

@alexispires
Copy link

alexispires commented Aug 7, 2024

Hi 👋

I would like to propose a PR to add support for read-only transactions when using PostgreSQL as source. Currently, Pgloader utilizes read-write transactions by default, which, while necessary for some operations like materialized views, may not always be required for other scenarios.

In my local tests (by modifying pomo configuration), I found that there are situations where read-only transactions would be sufficient and could offer significant benefits. For example, this feature would enable Pgloader to perform migrations from a standby server. Since standby servers are typically used for read-only purposes and can’t handle write operations, having support for read-only transactions would facilitate migrations from such sources without requiring additional setup or configuration.

Introducing an option to specify the type of transaction—read-only or read-write—would provide users with more flexibility and control over their migration processes. This change could enhance performance, reduce the risk of unintended data modifications, and simplify migrations from standby replicas.

Could you please provide your feedback on this proposal? Specifically, I would appreciate your thoughts on the best way to integrate this feature into the main branch, and whether you have any additional considerations or suggestions for the implementation.

Alexis

@alexispires
Copy link
Author

alexispires commented Aug 23, 2024

Thought something like this :

LOAD DATABASE
    FROM postgresql://user:password@source_host/source_db WITH read-only
    INTO postgresql://user:password@dest_host/dest_db
    ...

or this :

LOAD DATABASE
     FROM postgresql://user:password@source_host/source_db
     INTO postgresql://user:password@dest_host/dest_db

 WITH include drop, create tables, create indexes, ro src transaction

cc @dimitri

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

No branches or pull requests

1 participant