disable: synchronous_commit and commit_delay

This commit is contained in:
GroovieGermanikus 2024-06-25 20:48:28 +02:00
parent d1d7a7b525
commit 836ee631df
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
2 changed files with 14 additions and 1 deletions

View File

@ -383,7 +383,7 @@ async fn main() -> anyhow::Result<()> {
.collect_vec();
let mut block_senders = vec![];
info!("Starting {} block senders");
info!("Starting {} block senders", NUM_BLOCK_SENDERS);
for i in 1..=NUM_BLOCK_SENDERS {
let s = postgres::Postgres::new_with_workmem(i)
.await

View File

@ -194,6 +194,18 @@ impl PostgresSession {
info!("Disable parallel postgres workers");
}
pub async fn relax_commit_settings(&self) {
self.client
.execute("SET synchronous_commit TO 'off'", &[])
.await
.unwrap();
self.client
.execute("SET commit_delay TO 1000", &[])
.await
.unwrap();
info!("Configured synchronous_commit and commit_delay");
}
pub async fn drop_temp_table(&self, table: String) -> anyhow::Result<()> {
self.client
.execute(format!("drop table if exists {};", table).as_str(), &[])
@ -1307,6 +1319,7 @@ impl Postgres {
let session = PostgresSession::new(nb).await.unwrap();
let session = Arc::new(session);
session.configure_work_mem().await;
session.disable_postgres_workers().await;
Self { session }
}