storage/db: optimize query terms matching "upload"

Since the upload ID is part of the primary key, we can avoid using the
RecordLabels table to find matching records. This takes the query
"upload:20170127.22 name:Gzip" from ~0.3s to ~0.04s on our production

Change-Id: Id31624ec1b81f3a7f648c6597392718c56a10edd
Run-TryBot: Quentin Smith <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Russ Cox <>
3 files changed