From 96e5c3acae3a71ad4dcc37610a6654bdd587baa5 Mon Sep 17 00:00:00 2001 From: georgehao Date: Fri, 29 Sep 2023 21:02:24 +0800 Subject: [PATCH] feat: add chunk/batch get_task index --- .../00014_add_chunk_get_task_index.sql | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 database/migrate/migrations/00014_add_chunk_get_task_index.sql diff --git a/database/migrate/migrations/00014_add_chunk_get_task_index.sql b/database/migrate/migrations/00014_add_chunk_get_task_index.sql new file mode 100644 index 0000000000..23050e1e8f --- /dev/null +++ b/database/migrate/migrations/00014_add_chunk_get_task_index.sql @@ -0,0 +1,27 @@ +-- +goose Up +-- +goose StatementBegin + +drop index if exists idx_total_attempts_active_attempts_end_block_number; +drop index if exists idx_total_attempts_active_attempts_chunk_proofs_status; + +create index if not exists idx_chunk_proving_status_index on chunk (proving_status, index) where deleted_at IS NULL; +create index if not exists idx_batch_proving_status_index on batch (proving_status, chunk_proofs_status, index) where deleted_at IS NULL; + +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin + +create index if not exists idx_total_attempts_active_attempts_end_block_number + on chunk (total_attempts, active_attempts, end_block_number) + where deleted_at IS NULL; + +create index if not exists idx_total_attempts_active_attempts_chunk_proofs_status + on batch (total_attempts, active_attempts, chunk_proofs_status) + where deleted_at IS NULL; + + +drop index if exists idx_chunk_proving_status_index; +drop index if exists idx_batch_proving_status_index; + +-- +goose StatementEnd