diff options
author | Joey Hess <joey@kitenet.net> | 2014-03-13 09:38:20 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-03-13 09:38:20 -0400 |
commit | 1509ead6b2c676688249d91478bc4fbc70b50fc4 (patch) | |
tree | b3f09fbf6958b95c755710488b28e53b8545fd66 | |
parent | 77693b77a7c7ae09e340e3a609c0c310eeb68fa7 (diff) |
fixed slow query on normalized table; still 10x slower than current .map files
-rw-r--r-- | doc/design/caching_database.mdwn | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/design/caching_database.mdwn b/doc/design/caching_database.mdwn index 00a65d4b1..2eacc9bc5 100644 --- a/doc/design/caching_database.mdwn +++ b/doc/design/caching_database.mdwn @@ -67,6 +67,7 @@ CachedKey AssociatedFiles keyId CachedKeyId Eq associatedFile FilePath + KeyIdIndex keyId associatedFile deriving Show CachedMetaField @@ -86,6 +87,12 @@ LastFscked With this, running 1000 joins to get the associated files of 1000 Keys took 5.6s with warm cache. (When done in the same `runSqlite` call.) Ouch! +Update: This performance was fixed by adding `KeyIdOutdex keyId associatedFile`, +which adds a uniqueness constraint on the tuple of key and associatedFile. +With this, 1000 queries takes 0.406s. Note that persistent is probably not +actually doing a join at the SQL level, so this could be sped up using +eg, esquelito. + Compare the above with 1000 calls to `associatedFiles`, which is approximately as fast as just opening and reading 1000 files, so will take well under 0.05s with a **cold** cache. |