Skip to content

Commit

Permalink
Change Cache_tag_rowid to a partial index because we don't need to …
Browse files Browse the repository at this point in the history
…query rows efficiently `where tag IS NULL` (#307)

* Change `Cache_tag_rowid` to a partial index because we don't need to query rows efficiently `where tag IS NULL`

* Fix formatting
  • Loading branch information
ddorian authored Mar 3, 2024
1 parent 9cd3816 commit ebfa37c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion diskcache/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2028,7 +2028,10 @@ def create_tag_index(self):
"""
sql = self._sql
sql('CREATE INDEX IF NOT EXISTS Cache_tag_rowid ON Cache(tag, rowid)')
sql(
'CREATE INDEX IF NOT EXISTS Cache_tag_rowid ON Cache(tag, rowid) '
'WHERE tag IS NOT NULL'
)
self.reset('tag_index', 1)

def drop_tag_index(self):
Expand Down

0 comments on commit ebfa37c

Please sign in to comment.