forked from TrueCloudLab/frostfs-node
[#1433] metabase: Optimize Select
For some filters we can scan only a subset of keys instead of checking each key. ``` name old time/op new time/op delta Select/string_equal-8 49.3µs ± 4% 11.0µs ± 4% -77.68% (p=0.000 n=10+10) Select/string_not_equal-8 7.01ms ± 5% 7.06ms ±10% ~ (p=0.971 n=10+10) Select/common_prefix-8 118µs ± 6% 79µs ± 5% -33.04% (p=0.000 n=10+9) Select/unknown-8 21.3µs ± 4% 3.2µs ± 4% -84.88% (p=0.000 n=10+9) ``` Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
5c48588c64
commit
5073a37930
3 changed files with 171 additions and 31 deletions
|
@ -396,6 +396,29 @@ func TestDB_SelectPayloadHash(t *testing.T) {
|
|||
objectSDK.MatchNotPresent)
|
||||
|
||||
testSelect(t, db, cnr, fs)
|
||||
|
||||
t.Run("invalid hashes", func(t *testing.T) {
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter(v2object.FilterHeaderPayloadHash,
|
||||
payloadHash[:len(payloadHash)-1],
|
||||
objectSDK.MatchStringNotEqual)
|
||||
|
||||
testSelect(t, db, cnr, fs, object.AddressOf(raw1), object.AddressOf(raw2))
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter(v2object.FilterHeaderPayloadHash,
|
||||
payloadHash[:len(payloadHash)-2]+"x",
|
||||
objectSDK.MatchCommonPrefix)
|
||||
|
||||
testSelect(t, db, cnr, fs)
|
||||
|
||||
fs = objectSDK.SearchFilters{}
|
||||
fs.AddFilter(v2object.FilterHeaderPayloadHash,
|
||||
payloadHash[:len(payloadHash)-3]+"x0",
|
||||
objectSDK.MatchCommonPrefix)
|
||||
|
||||
testSelect(t, db, cnr, fs)
|
||||
})
|
||||
}
|
||||
|
||||
func TestDB_SelectWithSlowFilters(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue