From 11693a144ab6886699c3257b4d7e7301f7516e32 Mon Sep 17 00:00:00 2001 From: Matt Curtis Date: Tue, 27 Aug 2024 12:33:49 +0100 Subject: [PATCH] Enclave DB: add composite index for canonical batch height --- go/enclave/storage/init/edgelessdb/001_init.sql | 3 ++- go/enclave/storage/init/sqlite/001_init.sql | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go/enclave/storage/init/edgelessdb/001_init.sql b/go/enclave/storage/init/edgelessdb/001_init.sql index 387417c697..5f35eb0335 100644 --- a/go/enclave/storage/init/edgelessdb/001_init.sql +++ b/go/enclave/storage/init/edgelessdb/001_init.sql @@ -83,7 +83,8 @@ create table if not exists obsdb.batch INDEX USING HASH (hash), INDEX USING HASH (l1_proof_hash), INDEX (l1_proof), - INDEX (height) + INDEX (height), + INDEX (is_canonical, is_executed, height) ); GRANT ALL ON obsdb.batch TO obscuro; diff --git a/go/enclave/storage/init/sqlite/001_init.sql b/go/enclave/storage/init/sqlite/001_init.sql index 1085d1a45e..bc81cb0cd1 100644 --- a/go/enclave/storage/init/sqlite/001_init.sql +++ b/go/enclave/storage/init/sqlite/001_init.sql @@ -75,6 +75,7 @@ create index IDX_BATCH_HASH on batch (hash); create index IDX_BATCH_BLOCK on batch (l1_proof_hash); create index IDX_BATCH_L1 on batch (l1_proof); create index IDX_BATCH_HEIGHT on batch (height); +create index IDX_BATCH_HEIGHT_COMP on batch (is_canonical, is_executed, height); create table if not exists tx (