diff --git a/src/history/sqlite_backed.rs b/src/history/sqlite_backed.rs
index ec3b021a..36d8fc7c 100644
--- a/src/history/sqlite_backed.rs
+++ b/src/history/sqlite_backed.rs
@@ -349,8 +349,8 @@ impl SqliteBackedHistory {
             params.push((":cwd", Box::new(cwd_exact)));
         }
         if let Some(cwd_prefix) = &query.filter.cwd_prefix {
-            wheres.push("cwd like :cwd_like");
-            let cwd_like = format!("{cwd_prefix}%");
+            wheres.push("cwd glob :cwd_like");
+            let cwd_like = format!("{cwd_prefix}*");
             params.push((":cwd_like", Box::new(cwd_like)));
         }
         if let Some(exit_successful) = query.filter.exit_successful {