Skip to content

Commit

Permalink
sql: issue GetRequests from SQL when possible
Browse files Browse the repository at this point in the history
Previously, SQL unconditionally emitted ScanRequests for every read that
it produced, even if we were completely sure that the scan could contain
only a single key that was fully known at request time.

This was less efficient than necessary, because ScanRequests cause the
KV layer to do more work than GetRequests.

Here are the reasons why GetRequests are more efficient:

- MVCCGet, unlike MVCCScan, is able to use a prefix iterator, which
  allows it to make use of RocksDB/Pebble bloom filters. There may also
  be other wins at the storage layer, like avoiding prefetching
- various data structures have optimizations and fast-paths for
  single-key operations (e.g. timestamp cache, latch manager, refresh
  span tracking)
- various code paths are simpler in the point operation case
- a point operation implies only needing a single key allocation instead
  of a start and end key allocation
- a point operation implies only needing to return up to a single
  result, which means that we can avoid some indirection in various
  places
- A scan over a span that has at most 1 key, but does not know it, needs
  to iterate over all the versions (or eventually do a second expensive
  seek), looking for the non-existent next key in the span. A Get can do
  a single seek, read the key, and be done.

Release note (performance improvement): SQL will now emit GetRequests
when possible to KV instead of always emitting ScanRequests. This
manifests as a modest performance improvement for some workloads.
  • Loading branch information
jordanlewis committed Apr 14, 2021
1 parent aed8f19 commit 5b7a610
Show file tree
Hide file tree
Showing 38 changed files with 405 additions and 254 deletions.
6 changes: 2 additions & 4 deletions pkg/ccl/logictestccl/testdata/logic_test/multi_region
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ vectorized: true
table: orders@primary
spans: [/'ap-southeast-2'/'94e4b847-8f2f-4ac5-83f1-641d6e3df727' - /'ap-southeast-2'/'94e4b847-8f2f-4ac5-83f1-641d6e3df727'] [/'us-east-1'/'94e4b847-8f2f-4ac5-83f1-641d6e3df727' - /'us-east-1'/'94e4b847-8f2f-4ac5-83f1-641d6e3df727']
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJykk9tO20AQhu_7FKPhgoM2cnyABEtIRm1Kg9KEJlSt1I2Q8U5g22TX3V2rrlCu-mx9r8o2FIIaBOmFrT3MNzP_P_YN2u9zjLH3-Wxw3B_Czpv-5HzyYbALk96g9_octBFkLqRgkBu90LcrmREcT5rFxQ_prnXhLuqAu9s9ENJmulBuNbCJgrfj0fsmt4XTUX_YZLfwcdIfnsDOXa1d-PSuN-797QKOYPswouiyG3Va3Vkwa0Vptt_qhjO_dRD54oBCMesEnW1kqLSgYbogi_EXjHDKMDc6I2u1qY5u6oC-KDFuM5QqL1x1PGWYaUMY36CTbk4Y43l6OacxpYKM10aGglwq53XaRkGSG7lIzU9kOMlTZWPwOCYcPY6cl4cR5yVVr8vuCedld-ad_v7FeTnzBeelL9RRtelsc2xtyHlbkCoBPmh3TQYZjgoXQ-KzJGBJiNMlQ124e4XWpVeEsb9km7ngP9uFqu_2hk5synpbz3YgWOvAvfBC1fpIrIieLv_h0VC3dO4Fq-4M5EI68Nf20H7JFE61VLdDCFfLND_QgyEMtP5W5PBVSwVaxZBUwJiUIFM7A0nIIAmqZy_ZX9te-JL2xmRzrSw9smqd8ClDElfU-G11YTI6MzqryzTbUc3VB4Ksa26DZtNX9VX9FT-E_f-BgyfhcAVuP4bDJ-HoETxdvvoTAAD__499yik=
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJykUttO20AQfe9XjOaFizZKfIEES0hGbUqD0oQmVK3UtZDxjmHbZNfdXauuUJ76bf2vyjYUghoE9MHWzuXMnHM012i_LzDC4efT8dFoAttvRvOz-YfxDsyH4-HrM9BGkDmXgkFh9FLfvGRGcDRvH-c_pLvSpTtvGm6ruyCkzXSp3Hpj2wVvZ9P37WwLJ9PRpJ1u4eN8NDmG7dtdO_Dp3XA2_MsCDmHrIKTwYhD2O4Pczzthmu11BkHudfZDT-xTIPK-399ChkoLmqRLshh9wRAThoXRGVmrTZ26bhpGosKox1CqonR1OmGYaUMYXaOTbkEY4Vl6saAZpYJMt4cMBblULpqxrYK4MHKZmp_IcF6kykbQ5Rhz7HLkvDoIOa-o_l0MjjmvBnn35PcvzqvcE5xXnlCHddDf4tjtdSBVAjzQ7ooMMpyWLoLYY7HP4gCTFUNdujuq1qWXhJG3Yi-T4z1ZTk289zJJT5bhb5Rxx75UDUkSa8yT1T-ETnRHF11_XeJYLqUDbyOH3nOsPNFS3TgZrK9pz_mek2Otv5UFfNVSgVYRxDVgRkqQaZyBOGAQ-_W3G-9tpBc8h96MbKGVpQdWbRKeMCRxSa3fVpcmo1Ojs2ZNG04bXJMQZF1b9dtgpJpSc4r3wd7_gP1HwcEauPcQHDwKDh-Ak9WrPwEAAP__jsyklQ==

query T nodeidx=3
USE multi_region_test_db; EXPLAIN (DISTSQL) SELECT
Expand Down Expand Up @@ -1511,7 +1511,7 @@ vectorized: true
table: orders@primary
spans: [/'ap-southeast-2'/'94e4b847-8f2f-4ac5-83f1-641d6e3df727' - /'ap-southeast-2'/'94e4b847-8f2f-4ac5-83f1-641d6e3df727'] [/'us-east-1'/'94e4b847-8f2f-4ac5-83f1-641d6e3df727' - /'us-east-1'/'94e4b847-8f2f-4ac5-83f1-641d6e3df727']
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJykk19v2jwUxu_fT2GdXvRdZZq_BRqpkquNbVQMOqi0STNCaXzSegM7c5wtU8XVPtu-15SEtgMN1LILSHx8fjnPeexzB_nXOUTQ-3g5OO8Pyf-v-pOryfvBCzLpDXovr4g2As1MCkoyoxc6P64fq4BMkJxPmpfZd2lvdWFndcL97hERMk90oex6YpNFXo9H75oSObkY9YerImR0_3YsVaoJ44XrBrjKbGIf3vbGvQd55IwcnoYYXnfDTqub-mkrjJOTVjdIvVY79EQbA5F2_M4hUFBa4DBeYA7RJwhhSiEzOsE816YK3dUJfVFC5FKQKitsFZ5SSLRBiO7ASjtHiOAqvp7jGGOBxnGBgkAby3n92UYpy4xcxOYHUJhkscoj4nBgHBwOnJenIeclVn_X3Tecl93Uufj1k_My9QTnpSfUWbXoHHJo7ck5ByRWgnhE21s0QGFU2IgwjzKfshCmSwq6sI8d5ja-QYi8Jd3PBe_JLlS63T2d2Jd1Dp7sgL_VgcfGC1X3h2Kt6enyLx4NdUtnjr_uzkAupCXeVg3uc06hr76hsSgutFRonGC9VDNMrHnMqvmZSVECfcB6ZWYIaz9MGgs2rAp2uRU8R2mlcHVdwi0q76_LQOsvRUY-a6mIVhFhFTAaEtZZFzpGJdDUWgk7oYT51e-ItbcqDp-jeIx5plWOG-e87dSmFFDcYHNZcl2YBC-NTuoyzXJUc3VAYG6bXb9Z9FW9VY_gn7D3L7C_Ew7WYHcTDnbC4W443AmfbMDT5X-_AwAA___uBSO6
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJykk99uGjsQxu_PU1hzk9PIhP0XICtFctTSlohCCpFaqUZos55N3IK9tb3tVhFXfba-V7W7JCmooCS9ANvj-Zjf5xluwX5dQAz9jxfDs8GI_P9qML2cvh--INP-sP_ykmgj0MyloCQ3eqntUb2sAzJFcjZtNvPv0t3ows3rhLvbQyKkTXWh3GZik0VeT8bvmhKWnI8Ho3URMr7bHUmVacJ44XkhrjOb2Ie3_Un_Ho-ckoOTCKOrXtRt9bIga0VJetzqhZnf6kS-6GAosm7QPQAKSgscJUu0EH-CCGYUcqNTtFabKnRbJwxECbFHQaq8cFV4RiHVBiG-BSfdAiGGy-RqgRNMBJq2BxQEukQu6p9tSFlu5DIxP4DCNE-UjUmbA-PQ5sB5eRJxXmL1ddV7w3nZy9rnv35yXma-4Lz0hTqtDt0DDm2vRRIliE-0u0EDFMaFiwnzKQsoi2C2oqAL94BqXXKNEPsr-jw7_qPtVODe8yw92kaw08YDfaFqSBQb5LPVX4yOdEvn7WDT4lAupSP-TgbvKU85UN_QOBTnWio07XCzVDParFnm1TTPpSiB3sv6ZW4I69zPPQu3nirc91rhU0grwnXPox2Udz0fav2lyMlnLRXRKiasEoxHhHU3QSeoBJqalbBjSlhQfQ5ZZydx9BTiCdpcK4tbfd7VtRkFFNfYDIvVhUnxwui0LtMcx7WuDgi0rrkNmsNA1Vf1_-hPsf8v4mCvONwQe9vicK842i-O9oqPt8Sz1X-_AwAA__8IW_4X

subtest enum_name_clash

Expand All @@ -1527,5 +1527,3 @@ ALTER DATABASE db_enum_name_clash SET PRIMARY REGION "us-east-1"
statement ok
DROP TYPE db_enum_name_clash.crdb_internal_region;
ALTER DATABASE db_enum_name_clash SET PRIMARY REGION "us-east-1"


28 changes: 14 additions & 14 deletions pkg/ccl/logictestccl/testdata/logic_test/regional_by_row
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ SELECT message FROM [SHOW KV TRACE FOR SESSION] WITH ORDINALITY
OR message LIKE 'Scan%'
ORDER BY ordinality ASC
----
Scan /Table/73/1/"@"/1{-/#}, /Table/73/1/"\x80"/1{-/#}, /Table/73/1/"\xc0"/1{-/#}
Scan /Table/73/1/"@"/1/0, /Table/73/1/"\x80"/1/0, /Table/73/1/"\xc0"/1/0
fetched: /regional_by_row_table/primary/'ap-southeast-2'/1/pk2/a/b/j -> /1/2/3/'{"a": "b"}'
output row: [1 1 2 3 '{"a": "b"}']

Expand All @@ -716,7 +716,7 @@ vectorized: true
table: regional_by_row_table@primary
spans: [/'ca-central-1'/1 - /'ca-central-1'/1] [/'us-east-1'/1 - /'us-east-1'/1]
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJykkVEL0zAQx9_9FOF8Uclo0ylIQIhoxULdZjtQsGVkzTGLXVKTFDdGv7usRbbJJmw-3l3-l98vOYD72QCH-OsifZvMyLP3Sb7MP6fPSR6n8bsleUE-ZPNPxOKmNlo2q_V-Zc2vlZfrBsmXj3EWk_YHeUMYUNBG4Uxu0QH_BgxKCq01FTpn7LF1GA4kagc8pFDrtvPHdkmhMhaBH8DXvkHgsDxuz1AqtEEIFBR6WTfD2qsgorX1Vto9UMhbqR0nQQFFsXsdFhCwyXkRPCVSK8KI8d_RAoV55zkRjIqIiikVL6l4BWVPwXT-BOi83CBw1tPHJNijEuKPgBjh7wSObgKfODttrEKL6oKx7K8ozczEtEF0KZPW29oTdpMhvOfRMnSt0Q7_Yrm1uaSAaoOjkDOdrXBhTTVcM5bzITc0FDo_TqOxSPQwGn71PMz-Jxz9Mzy9CId92T_5HQAA__-b4SGh
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJykkVFr2zAUhd_3K8R92oaCLWeDIRh4bB4zeElmB1aoTVCsS2rqSK4k04Tg_15iF9KUpJD08Z6rc_QdaQf2oQYO0c0s-RFPyMdfcTbP_iWfSBYl0c85-Ux-p9O_xOCq0krUi-V2YfTjwolljeT_nyiNSHNPvhMGFJSWOBFrtMBvgUFBoTG6RGu12Uu7_kAsN8B9CpVqWreXCwqlNgh8B65yNQKH-T49RSHReD5QkOhEVfexJ0HCxlRrYbZAIWuEspx4OeT55pufg8c8f0SEkoQR7e7QAIVp6zgJGQ0DGo5p-IWGX6HoKOjWHaCsEysEzjp6HTi7Fjx8hr4QNDgLeuBrlTYSDcojtqI7UWWiR7rxguMSSbWuHGFnGfxLHitF22hl8RXLueSCAsoVDoWsbk2JM6PL_pphnPa-XpBo3bANhiFW_ar_zZdm9h5z8KZ5fGT2u6L78BQAAP__zHAczQ==

statement ok
SET tracing = on,kv,results; SELECT * FROM regional_by_row_table WHERE pk = 1; SET tracing = off
Expand All @@ -728,7 +728,7 @@ SELECT message FROM [SHOW KV TRACE FOR SESSION] WITH ORDINALITY
OR message LIKE 'Scan%'
ORDER BY ordinality ASC
----
Scan /Table/73/1/"@"/1{-/#}
Scan /Table/73/1/"@"/1/0
fetched: /regional_by_row_table/primary/'ap-southeast-2'/1/pk2/a/b/j -> /1/2/3/'{"a": "b"}'
output row: [1 1 2 3 '{"a": "b"}']

Expand All @@ -743,8 +743,8 @@ SELECT message FROM [SHOW KV TRACE FOR SESSION] WITH ORDINALITY
OR message LIKE 'Scan%'
ORDER BY ordinality ASC
----
Scan /Table/73/1/"@"/10{-/#}
Scan /Table/73/1/"\x80"/10{-/#}, /Table/73/1/"\xc0"/10{-/#}
Scan /Table/73/1/"@"/10/0
Scan /Table/73/1/"\x80"/10/0, /Table/73/1/"\xc0"/10/0
fetched: /regional_by_row_table/primary/'ca-central-1'/10/pk2/a/b -> /10/11/12
output row: [10 10 11 12 NULL]

Expand Down Expand Up @@ -824,9 +824,9 @@ SELECT message FROM [SHOW KV TRACE FOR SESSION] WITH ORDINALITY
OR message LIKE 'Scan%'
ORDER BY ordinality ASC
----
Scan /Table/75/1/"@"/10{-/#}, /Table/75/1/"\x80"/10{-/#}, /Table/75/1/"\xc0"/10{-/#}
Scan /Table/75/1/"@"/10/0{-/NULL}, /Table/75/1/"\x80"/10/0{-/NULL}, /Table/75/1/"\xc0"/10/0{-/NULL}
fetched: /child/primary/'ap-southeast-2'/10/c_p_id -> /10
Scan /Table/74/1/"@"/10{-/#}, /Table/74/1/"\x80"/10{-/#}, /Table/74/1/"\xc0"/10{-/#}
Scan /Table/74/1/"@"/10/0, /Table/74/1/"\x80"/10/0, /Table/74/1/"\xc0"/10/0
fetched: /parent/primary/'ap-southeast-2'/10 -> NULL

statement ok
Expand Down Expand Up @@ -862,7 +862,7 @@ vectorized: true
table: child@primary
spans: [/'ca-central-1'/10 - /'ca-central-1'/10] [/'us-east-1'/10 - /'us-east-1'/10]
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k1Fr2zAQx9_3KY7bQ5KhEtlxoQgKLqvLXDynSwwrLKZ41tF6SyRPliEl5LuP2GGNwxLSjr35Tve3fv_T3QqrX3MUGNzfRVdhDP3rcJpMv0QDmAZR8DGBD3AzGX-G_KmYS_j6KZgE0I_HCQT3m0Lod8vKzJCy27ryoZBwCfnD5mMwgKv4Gvp5m3T4ABkqLSnOFlSh-IYOpgxLo3OqKm02qVVTEMolCs6wUGVtN-mUYa4NoVihLeycUGCSfZ_ThDJJZsiRoSSbFfPmtw25X5pikZlnZDgtM1UJGM5wNlte8BkOHX7WiYbvIVMSHND2iQwyHNdWgO8w38V0zVDX9oWkstkjoXDW7G20zqm0_h9Sf0t5Gpl7kOwFqFbaSDIkOzDp-i_ssT7T5dDtUkfForDgHGTgr-nOrS7Utjmj7jXJc0kCouAmgas4CeF2HMbIsB26naZFWv-sS_ihCwVaCej7I7gE392OoO_BJSx7Hu8JIXyHc37uDU5r5uiNRrz_ZWSzssvexa4VBste3vF2ojnvNeYmVJVaVbQ3MYfeP2VI8pHasat0bXK6MzpvrmnDcaNrEpIq2566bRCq5qhZsl2x8y9i96h41BHzffHoqNg7LvaOis_3xOn63e8AAAD__2Pcwcc=
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k2Fr2zwQx98_n-K4N0keVCI7LhRBwWF1mYvndIlhhcUUzzpab4nkyTKkhHz3ETujcVhC2rF31un-vt__dLfG6ucCBQYP99E4jKF_E86S2edoALMgCj4k8D_cTiefIH8uFhK-fAymAfTjSQLBwzYR-t20MjOk7C6vfCwkXEP-uP0YDGAc30A_b4MOHyBDpSXF2ZIqFF_RwZRhaXROVaXNNrRuEkK5QsEZFqqs7TacMsy1IRRrtIVdEApMsm8LmlImyQw5MpRks2LR_LYh90tTLDPzggxnZaYqAcM5zuerKz7HocOH_AIyJcEBbZ_JIMNJbQX4DvNdTDcMdW1fi1c2eyIUzoa9D9A5F9D_DXcekHsU6JWjVtpIMiQ7DOnmD8ixvtDl0O3CRsWysOAcZeBvacqdLtSuJ6NumeSlJAFRcJvAOE5CuJuEMTJsx2uvV5HWP-oSvutCgVYC-v4IrsF3d8Pme3ANq57He0II3-GcX3qD85o5eqcR718Z2S7nqne1b4XBqpd3vJ1pznuLuSlVpVYVHUzMsfdPGZJ8onbsKl2bnO6Nzpsy7XHS6JqApMq2t257CFVz1ezWvtj5G7F7UjzqiPmheHRS7J0WeyfFlwfidPPfrwAAAP__ND-8kw==

statement ok
SET tracing = on,kv,results; SELECT * FROM child WHERE NOT EXISTS (SELECT * FROM parent WHERE p_id = c_p_id) AND c_id = 10; SET tracing = off
Expand All @@ -874,9 +874,9 @@ SELECT message FROM [SHOW KV TRACE FOR SESSION] WITH ORDINALITY
OR message LIKE 'Scan%'
ORDER BY ordinality ASC
----
Scan /Table/75/1/"@"/10{-/#}
Scan /Table/75/1/"@"/10/0
fetched: /child/primary/'ap-southeast-2'/10/c_p_id -> /10
Scan /Table/74/1/"@"/10{-/#}
Scan /Table/74/1/"@"/10/0
fetched: /parent/primary/'ap-southeast-2'/10 -> NULL

statement ok
Expand All @@ -890,11 +890,11 @@ SELECT message FROM [SHOW KV TRACE FOR SESSION] WITH ORDINALITY
OR message LIKE 'Scan%'
ORDER BY ordinality ASC
----
Scan /Table/75/1/"@"/20{-/#}
Scan /Table/75/1/"\x80"/20{-/#}, /Table/75/1/"\xc0"/20{-/#}
Scan /Table/75/1/"@"/20/0
Scan /Table/75/1/"\x80"/20/0, /Table/75/1/"\xc0"/20/0
fetched: /child/primary/'ca-central-1'/20/c_p_id -> /20
Scan /Table/74/1/"@"/20{-/#}
Scan /Table/74/1/"\x80"/20{-/#}, /Table/74/1/"\xc0"/20{-/#}
Scan /Table/74/1/"@"/20/0
Scan /Table/74/1/"\x80"/20/0, /Table/74/1/"\xc0"/20/0
fetched: /parent/primary/'ca-central-1'/20 -> NULL

query T
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/dist_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ func (ds *DistSender) initAndVerifyBatch(
case *roachpb.ReverseScanRequest:
// Accepted reverse range requests.

case *roachpb.QueryIntentRequest, *roachpb.EndTxnRequest:
case *roachpb.QueryIntentRequest, *roachpb.EndTxnRequest, *roachpb.GetRequest:
// Accepted point requests that can be in batches with limit.

default:
Expand Down
12 changes: 6 additions & 6 deletions pkg/kv/kvserver/batcheval/cmd_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ func Get(
h := cArgs.Header
reply := resp.(*roachpb.GetResponse)

var val *roachpb.Value
var intent *roachpb.Intent
var err error
if h.MaxSpanRequestKeys < 0 || h.TargetBytes < 0 {
// Receipt of a GetRequest with negative MaxSpanRequestKeys or TargetBytes
// indicates that the request was part of a batch that has already exhausted
Expand All @@ -47,19 +44,22 @@ func Get(
reply.ResumeReason = roachpb.RESUME_KEY_LIMIT
return result.Result{}, nil
}
var val *roachpb.Value
var intent *roachpb.Intent
var err error
val, intent, err = storage.MVCCGet(ctx, reader, args.Key, h.Timestamp, storage.MVCCGetOptions{
Inconsistent: h.ReadConsistency != roachpb.CONSISTENT,
Txn: h.Txn,
FailOnMoreRecent: args.KeyLocking != lock.None,
LocalUncertaintyLimit: cArgs.LocalUncertaintyLimit,
})
if err != nil {
return result.Result{}, err
}
if val != nil {
reply.NumKeys = 1
reply.NumBytes = int64(len(val.RawBytes))
}
if err != nil {
return result.Result{}, err
}
var intents []roachpb.Intent
if intent != nil {
intents = append(intents, *intent)
Expand Down
2 changes: 2 additions & 0 deletions pkg/kv/kvserver/batcheval/cmd_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,6 @@ func TestGetResumeSpan(t *testing.T) {
assert.Nil(t, resp.ResumeSpan)
assert.NotNil(t, resp.Value)
assert.Equal(t, resp.Value.RawBytes, value.RawBytes)
assert.Equal(t, 1, int(resp.NumKeys))
assert.Equal(t, len(resp.Value.RawBytes), int(resp.NumBytes))
}
2 changes: 1 addition & 1 deletion pkg/sql/as_of_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func TestAsOfRetry(t *testing.T) {
defer magicVals.Unlock()

switch req := args.Req.(type) {
case *roachpb.ScanRequest:
case *roachpb.GetRequest:
if kv.TestingIsRangeLookupRequest(req) {
return nil
}
Expand Down
16 changes: 15 additions & 1 deletion pkg/sql/distsql_physical_planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,21 @@ func (dsp *DistSQLPlanner) PartitionSpans(
// nodeMap maps a nodeID to an index inside the partitions array.
nodeMap := make(map[roachpb.NodeID]int)
it := planCtx.spanIter
for _, span := range spans {
for i := range spans {

span := spans[i]
if len(span.EndKey) == 0 {
// If we see a span to partition that has no end key, it means that we're
// going to do a point lookup on the start key of this span.
//
// The code below us doesn't really tolerate spans without an EndKey, so
// we manufacture a single-key span for this case.
span = roachpb.Span{
Key: span.Key,
EndKey: span.Key.Next(),
}
}

// rSpan is the span we are currently partitioning.
rSpan, err := keys.SpanAddr(span)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ network usage: <hidden>
table: kv@primary
spans: [/0 - /0]
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMkMFK80AUhff_U1zOv52fJNuBH4oSsVStpKUuJItpcqkh6UycmVRLyWP5Aj6ZZEYUEcHl-c6953LuCe6xg8Qqv8rP19TSRbG8pvZAd5d5kVNL_ymFgDY136g9O8h7ZCgFemsqds7YCZ3CwLx-hkwFGt0PfsKlQGUsQ57gG98xJNZq23HBqmabTME1e9V0IbY9zHrb7JU9QmDVK-0kJem_JE3-QmA5eEmzDAKLDflmz5LS1xcXdWW0Z-0bo79Z1jw5sqxqGYosNrQ9ev5AdAaBrfLVAzsyg--nM9Ng2PsE5SgQ1Xsx59WOIbNR_L58wa432vGX3j8lp2MpwPWO44OdGWzFt9ZU4UyUy7AXQM3ORzeLYq6jNZbjn7cAAAD__0UFm94=
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMkFFLwzAUhd_9FZfzHGn7GhCGUnFsbtLN-SB9yNrLLO2SmqTTMfqz_AP-MmkjiojgS-B8J_dczj3BPTeQWKXz9GpNNV1ny1uqD_Rwk2Yp1XRBMQS0KXmh9uwgH5EgF2itKdg5Ywd0Gj9My1fIWKDSbecHnAsUxjLkCb7yDUNirbYNZ6xKttEQXLJXVTPG1odJa6u9skcIrFqlnaQojuLz4YkW9_M5BJadlzRJIDDbkK_2LCl-f3NBF0Z71r4y-pdlzYsjy6qUY5_ZhrZHz1-ILiGwVb54Ykem8-2wZvg4zn2DvBcI6rOf82rHkEkv_n-DjF1rtOMf9f9KjvtcgMsdhzs709mC76wpxjVBLse5EZTsfHCTIKY6WH3en30EAAD___6pnbQ=

# Test a query that has a subquery and a postquery.
statement ok
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ vectorized: true
table: json_tab@primary
spans: [/44 - /44]
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF9v2jwUxu_fT2Gd96Kt5ipxEqCNNIluzTQmBiwgbVMXTYZ4bSYaZ7aZWiG--5SE8bfYobDeOXF-5zz2eZ5MQf4agw_Bl177qtVBp9et_qD_qX2G-kE7eDtAFL0Lux_RT8nT74oO0ef3QRig0yFqfpvYtsvQyQ2JTs5QN0SnFL1Gnpevr4MQvfmKKGBIecw69J5J8G-AAAYHMLgQYcgEHzEpuci3psWHrfgBfBtDkmYTlb-OMIy4YOBPQSVqzMCHAR2OWchozIRlA4aYKZqMi_J_VTYzkdxT8QgY-hlNpY8szzu3PM_6HzB0J8pHTYKbDkQzDHyils2korcMfDLD1QX1uVBMWI11LU3yamd5b5_y14lUSTpSFrE3O-SHETETLM4PtNFuWWH4iO6ovNuio9lSUm2npGUdXvZ66pxa3a5B92IkOy-sfnR1HX7OM4t4a5_vat9Ya0-q-5Ps8GexSNLfKwYltnUlhEXOFyurJ9iP5CFI4wo35Owj8QNP0rlC15igCnFx92k-j0vtuXExlF_Y7uLF0kKOmhZy5LQ41e3qVLers7Crc7hdDRJX7Ood366G5nO71p9rV0P5xdwvX8yuzlHt6vzDn_sTjUMmM55KVum_befSWXzLyqNKPhEj1hN8VLQpH7sFV7yImVTlLikfWmm5lQtchYkWdvSwswmTVfhyDSb7wcQ7hHb1sKs9tKGzp7_umv7Kalq6rofrWrihhxta-EIPXxwyaT1smrSeNkz68pBJE0OyTNHSZ4sYwkW2LL6OuwZ8y-T7jMxAm2ZmwA1DI_qIbfaOZv_9CQAA___7R4gK
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF9v2jwUxu_fT2Gdm7Z6XSVOArSRJtGtmcbEgAWmbeqiyRCvzUTjzDZTK8R3n5Iw_hY7FNYbZOL8znns8zyZgvw1Bh-CL732VauDTq9b_UH_Y_sM9YN28GaAKHobdj-gn5Kn3xUdos_vgjBAp0PU_DaxbZehkxsSnZyhbohOKXqFPC9fXwchev0VUcCQ8ph16D2T4N8AAQwOYHAhwpAJPmJScpFvTYsXW_ED-DaGJM0mKn8cYRhxwcCfgkrUmIEPAzocs5DRmAnLBgwxUzQZF-X_qmxmIrmn4hEw9DOaSh9ZnmfZ58Wv1fnUbgOG7kT5qElw04FohoFP1LKnVPSWgU9muLquPheKCauxLqlJ_t9Z3tun_HUiVZKOlEXszQ75YUTMBIvzA220W1YYPqI7Ku-26Gi2lFTbKWlZh5e9njqnVrdr0L0Yyc4Lqx9dXYef88wi3trru9o31tqT6jYlO2xaLJL094pPiW1dCWGR88XK6gn2I3kI0rjCDTn7SHzPk3Su0DUGqUJc3H2az-NSe25cDOUXtrt4sbSQo6aFHDktTnW7OtXt6izs6hxuV4PEFbt6x7erofncrvXn2tVQfjH3yxezq3NUuzr_8OP-ROOQyYynklX6btu5dBbfsvKokk_EiPUEHxVtyr_dgisexEyqcpeUf1ppuZULXIWJFnb0sLMJk1X4cg0m-8HEO4R29bCrPbShs6e_7pr-ympauq6H61q4oYcbWvhCD18cMmk9bJq0njZM-vKQSRNDskzR0meLGMJFtiy-jrsGfMvk-4zMQJtmZsANQyP6iG32jmb__QkAAP__5vuJ4A==

# We cannot use the index for this query.
query T
Expand Down Expand Up @@ -431,7 +431,7 @@ vectorized: true
table: array_tab@primary
spans: [/1 - /1]
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k19r2zAUxd_3KcTdQ1umYEv5O8Mg2-KxjCzp7MA2NlMU-1IMqeVJ8lgJ-e7DdmnqUKtOx16MpavfPUc63B3oX1vwwP92uXg7X5Lz2Txch18WFyT0F_77NRHkQ7D6TIRS4vbKiA35-tEPfHK-IdOfhev2kZzt2P7sgqwCci7IG8LK35kfkHffiQAKmUxwKW5Qg_cDGFDgQKEPEYVcyRi1lqos7aqD8-QPeC6FNMsLU2-b1GwRPCgyqRJUmACFBI1It2U92kcUYqkQvMPRpezJ3BkdHaQgC3PXNqKgjbhG8AZ72iL9SONQKoPKGTc6w5S9grb2w1Paz1Jt0iw2zuRYACis6tt7pF4Vpvpr0x01dJlddy02WwxQJKgc1pS-z30qlLpKs99AIcxFpj3iMNdhvfLLOxjipxj6JNPszk-_zU-u0huhbg_SdMpb1fsNdd79Odyn5e-fo-cw52U3P-y5fnj3eHgVD39OPE8YehDP4D_HcxB9bPoBLPM_7DT_7ikDGqDOZaaxY-eIAibXWN9Dy0LFeKlkXMnUy1XFVRsJalNXWb2YZ3WpNPgQZlaY22FuhV_b4b4VHtjhgRV2GzA7hodWeGKHR1Z4bLc9_hflyUl3jvYv_gYAAP__5A1x4g==
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lF9r2zAUxd_3KcR9acsUbCl_ZxhkWzyWkSWdnbGNzRTFvhRDanmSPFZCvvuwXZo61KrTsRcj6ep3z5EO1g70ry144H-7XLyZL8n5bB6uw8-LCxL6C__dmgjyPlh9IkIpcXtlxIZ8_eAHPjnfkOnPwnX7SM52bH92QVYBORfkNWHlcOYH5O13IoBCJhNcihvU4P0ABhQ4UOhDRCFXMkatpSpLu2rjPPkDnkshzfLC1MsmNVsED4pMqgQVJkAhQSPSbVmP9hGFWCoE77B1KXsyd0ZHGynIwty1jShoI64RvMGetkg_0jiUyqByxo3OMGUvoa398JT2s1SbNIuNMzkWAAqr-vQeqWeFqUZtuqOGLrPrrsVmiwGKBJXDmtL3uU-FUldp9hsohLnItEcc5jqsV355B0P8FEMfZZrd-em3-clVeiPU7UGaTnmrer-hzrtfh_u0_P11OG6v_DjLL4tFN1vsubZ495R4lRJ_TkpPGHqQ0uA_p3QQfewRALA8A8NOz4B7yn8aoM5lprFj54gCJtdYn0PLQsV4qWRcydTTVcVVCwlqU1dZPZlndak0-BBmVpjbYW6FX9nhvhUe2OGBFXYbMDuGh1Z4YodHVnhstz3-F-XJSWeO9i_-BgAA____53O4

# The split disjunction rule allows us to use the index for this query.
query T
Expand Down Expand Up @@ -467,7 +467,7 @@ vectorized: true
table: array_tab@primary
spans: [/1 - /1]
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVGFv2jAQ_b5fYd0-tNVSJedAaSNNYltTjakrHVTapoEqQ05tJGpntqlaVfz3KQRBU8AB1E37grDP7967u5d7AvN7BBHEPy7PP7Qu2P5pq3vV_XZ-wLrxefzpigl21ml_ZUJr8XhtxYB9_xx3Yra_P2DN3jgIQmJ7TzjZO2DtDitd8sneQXEr2HuG-d_TuMM-_mQCPJAqoQtxRwaiX4DgAQcPQuh7kGk1JGOUzkNP04et5AGiwINUZmNbXNvUjggiGEulE9KUgAcJWZGO8nh_0vdgqDRBtHh6mhqbyqH166W30Mzp22MbsSZCf-KBGtsZT98DY8UNQVSbeGu0rGD6olLZIZGQ9o_KXPM-NjOd3gn9uKD2mnwte30b9q7SlrTfeFnlu7Xpj7ZJP2_jyao2FsNY0cpFgsEjuxXmdgk9HdpMUWOtokWeVYOflemSjVihu9oMx6-u7kIdqszH8IWLV9OflOjRPa4rMRjRzIy4zoxC6-tU3oMH3UxIEzEfAx8P899wM4fybTS15D1pS8lZOrKkSfvluufx-CHTTEnWxIiZXBgzVmgb9aDX44g9YCST2SnsAVurLiyp45t3LKj-fOcdO_TRf7tZt3BXPXzzCfLpBPmOE6zQtDTB2v80wdkGPN51A1akX6yS4J-tQP6qK5D_xRW4grhDJlPS0EbbLcilU3JDRalGjfWQLrUaTmmKY3uKm14kZGwRxeLQkkUoF_gcjE4wd4O5Exy6weFLMD4H10pg3A6MoRtdc-quu8F1d7tr7qqPnOiGG9xwggO37mO37gqfnLjRQYXL3B6tUI5uk2KFS3HJpts4rQJdZTVccqrTa_3Jmz8BAAD__zm3B-Y=
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVGFv2jAQ_b5fYd2Xtlqq5BwobaRJbGuqMTHooNM2DVQZcmoj0TizTdWq4r9PIQiaQhxA3bQvEfb53Xt397gn0L8nEED447L9vtVhh-et_lX_a_uI9cN2-PGKCXbR635hQinxeG3EiH3_FPZCdng4Ys3B1PN8YgdPODs4Yt0eK1zy2cFRfivYO4bZz_Owxz78ZAIcSGREHXFHGoJfgOAABwd8GDqQKjkmraXKQk_zh63oAQLPgThJpya_NrGZEAQwTaSKSFEEDkRkRDzJ4sPZ0IGxVATB6ul5rE2cjI1bL7yFZkbfnZqANRGGMwfk1Cx4hg5oI24IgtrMKdGygemzjJMeiYiUe1LkWvaxmar4TqjHFbXT5KXs9V3Y-1IZUm7jZZVvS9Of7JJ-2cazTW3Mh7GhlasEo0d2K_TtGno-tIWiRqmiVZ5Ng1-UaZONWKG72gynr66uI49l6qL_wsWb6c8K9Ggf15UYTWhhRiwzo1DqOk7uwYF-KhIdMBc9F4-zr7-dQ_kumlrJPSlD0UU8MaRIucW6l_HwIVVMJqyJAdOZMKaNUCYYwGDAEQfAKIkWJ38ArFSdX1DHt--YV_33XXbM9Y6zj9v51m5v1zTcVxbffpB8Pki-5yArNK0NsvY_DXKxCE_3XYQV6Vcbxftnm5C_6ibkf3ETbiDukU5lommrJedl0im6obxULadqTJdKjuc0-bE7x80vItImj2J-aCV5KBP4HIxWMLeDuRXs28H-SzA-B9cKYNwNjL4dXbPqrtvBdXu7a_aqT6zohh3csII9u-5Tu-4Kn5zZ0V6Fy-werVCOdpNihUtxzaa7OK0CXWU1XHOq1WvD2Zs_AQAA__8i-Qm8

# We cannot use the index for this query.
query T
Expand Down
Loading

0 comments on commit 5b7a610

Please sign in to comment.