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:
parent
0683074b8b
commit
70c2568af8
4 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue