Files
scroll/database/migrate/migrations/00010_add_index_chunk_prover_task.sql
2023-08-28 17:07:29 +08:00

20 lines
683 B
SQL

-- +goose Up
-- +goose StatementBegin
create index if not exists idx_chunk_hash on chunk(hash, deleted_at) where deleted_at IS NULL;
create index if not exists idx_proving_status_end_block_number_index on chunk(index, end_block_number, proving_status, deleted_at) where deleted_at IS NULL;
create index if not exists idx_publickey_proving_status on prover_task(prover_public_key, proving_status, deleted_at, id) where deleted_at is null;
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
drop index if exists idx_chunk_hash;
drop index if exists idx_proving_status_end_block_number_index;
drop index if exists idx_publickey_proving_status;
-- +goose StatementEnd