make sure all sqlite selects have indexes

Bearing in mind that these indexes are really uniqueness constraints
that just happen to also make sqlite generate indexes.

In Database.ContentIndentifier, the ContentIndentifiersKeyRemoteCidIndex
is fine as a uniqueness constraint because it contains all rows from the
table. The ContentIndentifiersCidRemoteIndex is also ok because there
can only be one key for a given (cid, uuid) combination.

In Database.Export, the new ExportTreeFileKeyIndex is the same pair as
the old ExportTreeKeyFileIndex (previously ExportTreeIndex). And
in Database.Keys.SQL, the new InodeCacheKeyIndex is the same pair as the
old KeyInodeCacheIndex.
This commit is contained in:
Joey Hess 2019-10-30 13:40:29 -04:00
parent 3732f27722
commit 9085a2cfec
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 10 additions and 19 deletions

View file

@ -76,7 +76,8 @@ ExportedDirectory
ExportTree
key Key
file SFilePath
ExportTreeIndex key file
ExportTreeKeyFileIndex key file
ExportTreeFileKeyIndex file key
-- The tree stored in ExportTree
ExportTreeCurrent
tree SSha
@ -165,9 +166,6 @@ getExportTree (ExportHandle h _) k = H.queryDbQueue h $ do
return $ map (mkExportLocation . fromSFilePath . exportTreeFile . entityVal) l
{- Get keys that might be currently exported to a location.
-
- Note that the database does not currently have an index to make this
- fast.
-
- Note that this does not see recently queued changes.
-}