From dde10d2dd76a1859ba94df922648ed6bb9e10dba Mon Sep 17 00:00:00 2001 From: jussisaurio Date: Sun, 6 Oct 2024 00:19:56 +0300 Subject: [PATCH] Better EXPLAIN QUERY PLAN for Operator::Search --- core/translate/plan.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/translate/plan.rs b/core/translate/plan.rs index 174ea2d3b..ea181ef85 100644 --- a/core/translate/plan.rs +++ b/core/translate/plan.rs @@ -426,8 +426,15 @@ impl Display for Operator { }?; Ok(()) } - Operator::Search { table, .. } => { - writeln!(f, "{}INDEX SCAN {}", indent, table.name)?; + Operator::Search { table_identifier, search, .. } => { + match search { + Search::PrimaryKeyEq { .. } | Search::PrimaryKeySearch { .. } => { + writeln!(f, "{}SEARCH {} USING INTEGER PRIMARY KEY (rowid=?)", indent, table_identifier)?; + } + Search::IndexSearch { index, .. } => { + writeln!(f, "{}SEARCH {} USING INDEX {}", indent, table_identifier, index.name)?; + } + } Ok(()) } Operator::Nothing => Ok(()),