This PR fixes #7954 by adding the exact SQL condition has_data = 1 to queries to the TorrentState table.
It allows SQLite query optimizer to use a partial index on TorrentState table, defined as
CREATE INDEX IF NOT EXISTS idx_torrentstate__last_check__partial
ON TorrentState (last_check, seeders, leechers, self_checked)
WHERE has_data = 1;
As a result, the speed of queries issued by the torrent checker icreases drastically, from 4 seconds to 0.04 seconds.
This PR fixes #7954 by adding the exact SQL condition
has_data = 1
to queries to theTorrentState
table. It allows SQLite query optimizer to use a partial index onTorrentState
table, defined asAs a result, the speed of queries issued by the torrent checker icreases drastically, from 4 seconds to 0.04 seconds.