Class PostgresProvider
implementation for PostgreSQL.
Uses COPY FROM STDIN (TEXT format) for bulk inserts and
session_replication_role = 'replica' to bypass foreign-key triggers
during import.
public sealed class PostgresProvider : IDataProvider, IAsyncDisposable, IParallelImportProvider
Inheritance
Implements
Properties
BuildsIndexesOfOneTableConcurrently
False when two index builds on the same table must not run side by side; the indexes of a
public bool BuildsIndexesOfOneTableConcurrently { get; }
Methods
AbortImportAsync()
Rolls back whatever the import wrote and restores the session state it changed. Called on every path
public Task AbortImportAsync()
BeginImportAsync(CancellationToken)
Starts the import transaction. Everything the import writes from here on - cleaning, rows, the
public Task BeginImportAsync(CancellationToken ct = default)
BulkInsertAsync(string, DataTable, CancellationToken)
Performs a bulk insert of the supplied
public Task BulkInsertAsync(string tableName, DataTable data, CancellationToken ct = default)
CleanDatabaseAsync(CancellationToken)
Truncates all REDB tables in the correct foreign-key order, leaving the schema intact.
public Task CleanDatabaseAsync(CancellationToken ct = default)
CommitImportAsync(CancellationToken)
Commits the import transaction and restores the session state the import changed.
public Task CommitImportAsync(CancellationToken ct = default)
CreateIndexAsync(DroppedIndex, CancellationToken)
Creates one index from the statement returned.
public Task CreateIndexAsync(DroppedIndex index, CancellationToken ct = default)
DisableConstraintsAsync(CancellationToken)
Disables foreign-key constraints and triggers so that rows can be
public Task DisableConstraintsAsync(CancellationToken ct = default)
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
DropLoadIndexesAsync(CancellationToken)
Drops the secondary indexes of the large tables and returns the statements that create them
public Task<IReadOnlyList<DroppedIndex>> DropLoadIndexesAsync(CancellationToken ct = default)
EnableConstraintsAsync(CancellationToken)
Re-enables foreign-key constraints and triggers after bulk import.
public Task EnableConstraintsAsync(CancellationToken ct = default)
ExecuteAsync(string, CancellationToken)
Executes a statement that returns no rows (DDL included). Inside an import it runs in the
public Task ExecuteAsync(string sql, CancellationToken ct = default)
ForgetDroppedIndexesAsync(CancellationToken)
Removes the stored definitions once every index is back.
public Task ForgetDroppedIndexesAsync(CancellationToken ct = default)
GetSequenceValueAsync(CancellationToken)
Returns the current value of the global_identity sequence.
public Task<long> GetSequenceValueAsync(CancellationToken ct = default)
GuidFromDb(object)
Reads a uuid-semantic column value into its portable form.
public Guid GuidFromDb(object raw)
GuidToDb(Guid)
Converts a portable into the value this provider stores in a
public object GuidToDb(Guid value)
OpenAsync(string, CancellationToken)
Opens a connection to the database using the supplied connection string.
public Task OpenAsync(string connectionString, CancellationToken ct = default)
OpenWorkerAsync(CancellationToken)
Opens one more connection to the same database, set up for loading: no transaction, and
public Task<IDataProvider> OpenWorkerAsync(CancellationToken ct = default)
ReadDateTimeOffset(DbDataReader, int)
Reads a date column of a redb table into its portable form.
public DateTimeOffset ReadDateTimeOffset(DbDataReader reader, int ordinal)
RelaxConstraintsForLoadAsync(CancellationToken)
Switches off foreign key checks and triggers for the load where that is a setting of the
public Task RelaxConstraintsForLoadAsync(CancellationToken ct = default)
RestoreConstraintsAfterLoadAsync(CancellationToken)
Undoes once the rows and the indexes are in, and
public Task RestoreConstraintsAfterLoadAsync(CancellationToken ct = default)
SetSequenceValueAsync(long, CancellationToken)
Resets the global_identity sequence to the specified value
public Task SetSequenceValueAsync(long value, CancellationToken ct = default)