Skip to content

Commit 9de7b9d

Browse files
committed
add comment about psql LIKE index usage
1 parent 5e740a4 commit 9de7b9d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/web/sitemap.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ pub fn sitemap_handler(req: &mut Request) -> IronResult<Response> {
5858
GROUP BY crates.name
5959
",
6060
&[
61-
// this LIKE pattern has the '%' only at the end,
62-
// so postgres can use the index on `name`
61+
// postgres can use the normal BTREE index on `name`
62+
// for LIKE queries, if they are anchored to the
63+
// beginning of the string.
64+
// This does not work for ILIKE and alphabetic
65+
// characters, hence the OR.
6366
&format!("{}%", letter),
6467
&format!("{}%", letter.to_uppercase()),
6568
],

0 commit comments

Comments
 (0)