mirror of
https://github.com/miniflux/v2.git
synced 2025-08-16 18:01:37 +00:00
perf(storage): pair all SELECT true
with LIMIT 1
Apparently, postgresql isn't smart enough to realize that once a true value value is found as part of a `SELECT true`, there is no need to scan the rest of the table, so we have to make this explicit. We could also have used the `SELECT EXISTS(…)` construct, but it's more verbose and I don't like it.
This commit is contained in:
parent
2e28bf78bd
commit
546fbcff8f
6 changed files with 14 additions and 14 deletions
|
@ -15,7 +15,7 @@ import (
|
|||
// HasFeedIcon checks if the given feed has an icon.
|
||||
func (s *Storage) HasFeedIcon(feedID int64) bool {
|
||||
var result bool
|
||||
query := `SELECT true FROM feed_icons WHERE feed_id=$1`
|
||||
query := `SELECT true FROM feed_icons WHERE feed_id=$1 LIMIT 1`
|
||||
s.db.QueryRow(query, feedID).Scan(&result)
|
||||
return result
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue