perf: force event hash index if filter uses ids

This commit is contained in:
Greg Heartsfield 2023-02-01 06:46:35 -06:00
parent 9c77b06f79
commit 2d3a35fe30

View File

@ -658,6 +658,9 @@ impl NostrRepo for SqliteRepo {
/// Decide if there is an index that should be used explicitly /// Decide if there is an index that should be used explicitly
fn override_index(f: &ReqFilter) -> Option<String> { fn override_index(f: &ReqFilter) -> Option<String> {
if f.ids.is_some() {
return Some("event_hash_index".into());
}
// queries for multiple kinds default to kind_index, which is // queries for multiple kinds default to kind_index, which is
// significantly slower than kind_created_at_index. // significantly slower than kind_created_at_index.
if let Some(ks) = &f.kinds { if let Some(ks) = &f.kinds {