1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Add index to speed up slow query

This commit is contained in:
Frédéric Guillot 2020-05-20 18:06:22 -07:00
parent 0683074b8b
commit 70c2568af8
4 changed files with 6 additions and 2 deletions

View file

@ -88,7 +88,7 @@ func (s *Storage) CreateEnclosure(enclosure *model.Enclosure) error {
// IsEnclosureExists checks if an attachment exists.
func (s *Storage) IsEnclosureExists(enclosure *model.Enclosure) bool {
var result int
query := `SELECT count(*) as c FROM enclosures WHERE user_id=$1 AND entry_id=$2 AND url=$3`
query := `SELECT 1 FROM enclosures WHERE user_id=$1 AND entry_id=$2 AND url=$3`
s.db.QueryRow(query, enclosure.UserID, enclosure.EntryID, enclosure.URL).Scan(&result)
return result >= 1
}