Skip to content

Commit 8689312

Browse files
committed
add index
1 parent 3c4c1e6 commit 8689312

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

pg_migrations/0001_create_inflight_activations.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ CREATE TABLE IF NOT EXISTS inflight_taskactivations (
1717
namespace TEXT NOT NULL,
1818
taskname TEXT NOT NULL,
1919
on_attempts_exceeded INTEGER NOT NULL DEFAULT 1
20-
) PARTITION BY LIST (partition);
20+
);
21+
22+
CREATE INDEX idx_activation_partition ON inflight_taskactivations (partition);

src/store/postgres_activation_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl InflightActivationStore for PostgresActivationStore {
276276
b.push_bind(row.taskname);
277277
b.push_bind(row.on_attempts_exceeded as i32);
278278
})
279-
.push(" ON CONFLICT(id) DO NOTHING")
279+
.push(" ON CONFLICT(id, partition) DO NOTHING")
280280
.build();
281281
let mut conn = self.acquire_write_conn_metric("store").await?;
282282
Ok(query.execute(&mut *conn).await?.into())

0 commit comments

Comments
 (0)