Use placeholders in search SQL
I didn't do that before in order to ensure that the planner could always optimize the LIKE queries, but it's optimizing them just fine with placeholders now.
This commit is contained in:
parent
3eb1cbae63
commit
b023bec0cd
1 changed files with 3 additions and 3 deletions
|
|
@ -777,9 +777,9 @@ sub dbSearch {
|
||||||
|
|
||||||
return !$name ? [] : $s->dbAll(
|
return !$name ? [] : $s->dbAll(
|
||||||
'SELECT name, section FROM man_index !W ORDER BY name, section LIMIT ?',
|
'SELECT name, section FROM man_index !W ORDER BY name, section LIMIT ?',
|
||||||
{ # Don't use wildcards in this query, prevents index usage.
|
{
|
||||||
"lower(name) LIKE '\L$name\E%'" => 1,
|
'lower(name) LIKE ?' => escape_like(lc $name).'%',
|
||||||
$sect ? ("section ILIKE '\L$sect\E%'" => 1) : ()
|
$sect ? ('section ILIKE ?' => escape_like(lc $sect).'%') : (),
|
||||||
},
|
},
|
||||||
$limit
|
$limit
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue