storage/db: query optimizations for duplicate keys

Queries with multiple parts referring to the same key are now
simplified before sending to the database. If the query can be proven
to return no results, the query is not sent to the database at all.

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