Skip to content

Commit ebfa37c

Browse files
authored
Change Cache_tag_rowid to a partial index because we don't need to query rows efficiently where tag IS NULL (grantjenks#307)
* Change `Cache_tag_rowid` to a partial index because we don't need to query rows efficiently `where tag IS NULL` * Fix formatting
1 parent 9cd3816 commit ebfa37c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

diskcache/core.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -2028,7 +2028,10 @@ def create_tag_index(self):
20282028
20292029
"""
20302030
sql = self._sql
2031-
sql('CREATE INDEX IF NOT EXISTS Cache_tag_rowid ON Cache(tag, rowid)')
2031+
sql(
2032+
'CREATE INDEX IF NOT EXISTS Cache_tag_rowid ON Cache(tag, rowid) '
2033+
'WHERE tag IS NOT NULL'
2034+
)
20322035
self.reset('tag_index', 1)
20332036

20342037
def drop_tag_index(self):

0 commit comments

Comments
 (0)