-
Notifications
You must be signed in to change notification settings - Fork 500
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
Update DB layer to use COPY to insert into history tables #4908
Comments
@tamirms, What happens during reingestion of a ledger range? I understand that it updates the history tables. I recall reading somewhere that it's ok for there to be an overlapping ledgers because the reingestion simply overwrites the existing data, is that correct? |
@urvisavla during reingestion we delete rows in the history tables before we insert them: https://github.com/stellar/go/blob/master/services/horizon/internal/ingest/fsm.go#L734 |
Currently, we use the BatchInsertBuilder to batch history table rows into large Postgres
INSERT
statements. However, we have discovered that it is more efficient to use the PostgresCOPY
statement for bulk loading. Note thatCOPY
does not provide support for updating existing rows but that is ok because the Horizon history tables are immutable (rows are only inserted and never updated).To complete this issue we will need to:
COPY
instead ofINSERT
(feel free to use the prototype from the spike)services/horizon/internal/db2/history
code which inserts rows into the history tables (see master...tamirms:go:ingest-perf-pq for how this is done in the spike branch). After this task is complete the following tables will be populated by theCOPY
batch insert builder:The text was updated successfully, but these errors were encountered: