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

copy Postgres to SQLite, get last LSN #52

Open
tantaman opened this issue May 31, 2024 · 8 comments
Open

copy Postgres to SQLite, get last LSN #52

tantaman opened this issue May 31, 2024 · 8 comments

Comments

@tantaman
Copy link

I saw that pgtcl can be used to quickly copy a Postgres DB to SQLite. Once I do this, however, how can I know what LSN I should start from to continue replicating (via logical replication) the PG DB to SQLite?

@resuna
Copy link
Member

resuna commented May 31, 2024

That's what I implemented deltaflood for. The work is probably incomplete however, the project that required it changed its focus. Have a look at https://github.com/flightaware/pg-deltaflood

@resuna
Copy link
Member

resuna commented May 31, 2024

Yes, the reader side is still internal/research quality and hasn't been released.

@tantaman
Copy link
Author

tantaman commented Jun 2, 2024

How likely is it the reader side would be released?

@resuna
Copy link
Member

resuna commented Jun 3, 2024

I would have to go through and remove any proprietary code and then see if what's left is functional, and if not implement the missing bits. Your reader is probably going to be application-specific. You need to read a line, split it on tabs into name-value pairs, then perform a backslash escape substitute operation on the value to parse it. The Tcl [subst] command would do that. Check the README.md for how to handle the update and replace operations on the new database, depending on the primary key.

@resuna
Copy link
Member

resuna commented Jun 3, 2024

Yeh, looking at our code, we're taking a side-route via Kafka you probably don't want to get involved in. :)

@resuna
Copy link
Member

resuna commented Jun 3, 2024

You can also look at Debezium, though it doesn't have an sqlite connector yet, you'd have to write that any way.

@NasaGeek
Copy link
Member

NasaGeek commented Jun 3, 2024

One could probably use the JDBC Debezium connector combined with a sqlite JDBC library like https://github.com/xerial/sqlite-jdbc to perform the replication.

@tantaman
Copy link
Author

tantaman commented Jun 3, 2024

Also, any idea how fast your pg to SQLite conversion is? Say for a 10GB db of 30 million rows.

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

3 participants