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 6, 2021
1 parent 6f06d90 commit 2cd87ed
Show file tree
Hide file tree
Showing 36 changed files with 382 additions and 234 deletions.
4 changes: 2 additions & 2 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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Ndujuq1qWXhJG3Yi-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,4 +1511,4 @@ 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_VgcfGC1X3h2Kt6enyLx4Nd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deletions pkg/ccl/logictestccl/testdata/logic_test/regional_by_row
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,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 @@ -673,7 +673,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 @@ -685,7 +685,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 @@ -700,8 +700,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
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
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_6HzB0J8pHTYKbDkQzDHyils2korcMfDLD1QX1uV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uV4PEFbt6x7erofncrvXn2tVQfjH3yxezq3NUuzr_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-NjOd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JqyJAdOZMKaNUCYYwGDAEQfAKIkWJ38ArFSdX1DHt--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
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/merge_join_dist_vec
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ vectorized: true
table: r@primary
spans: [/2 - /2]
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEk9GPk0AQxt_9KzbjS6t7gd3iyyaXYJRTLj04gYsmhoe9MrYkHIu7S2LT9H83gEkFe7UXo76xu_P7Zr5vwg7M1woEBJ9ul6_DiMzehmmWfljOSRosgzcZeUGukviGVGQZXGXkOg4josldGkbvyEzOycf3QRIQSS4JBwq1KjCSD2hAfAYGFDjkFBqtVmiM0t31ri8Ki28gXApl3bS2u84prJRGEDuwpa0QBGTyvsIEZYHa6bQKtLKsemntN7p8kHoLFNJG1kYQh1843HkO-Z6Cau0P2YPa_ZZspNmMdXwG-T6nYKxcIwi-p4-Md9Bpa6UL1FiMlPKO_F3JEY83qNd4rcoatbMYz5ZtGxRD6vFdFiR99kChwi925rOX80tdrjfDJ1CIWyuIz6jPqe9NUjg4XPyBwyPjR-pCNY43jeJoa2_Ump2_e3ecS_V3ds8eHe9f7J7_190fGS5B06ja4FmrdTt7WKxxiMuoVq_wVqtV32Y4xj3XJ1ugscOrNxzCun_qf7_zYXYaZlPY_RnmI5hNYX4SfjWC3Sm8eILnXzqfhtlp2HuS53z_7HsAAAD___ZW7z0=
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEk1-Pk0AUxd_9FJP71OpsYCi-TLIJRlllw8IKNJoYHmbLtSVhGZwZEpum390AJhXs1jZG96Xp_Pmde8-Zyw70two4-J_vwzdBRGbvgjRLP4Zzkvqh_zYjL8lNEt-RioT-TUZu4yAiiizTIHpPZmJOPn3wE58Ick0coFDLAiPxiBr4F2BAwYGcQqPkCrWWqtve9ZeC4jtwm0JZN63ptnMKK6kQ-A5MaSoEDpl4qDBBUaCyOq0CjSirXlp5jSofhdoChbQRtebEciz7qvuxomUYQr6nIFvzU_0g-rAlG6E3YzmPQb7PKWgj1gjc2dMnujzotLVUBSosRkp5R_7pyhGrd6jWeCvLGpW1GPeWbRvkQ_jxMvOT_gmAQoVfzcxjr-bXqlxvhr9AIW4NJx6jnkM9d5LCweHiLxweaT-SV7Kx3GkUR0u7o9Ls_BGwx7lU_3QE2JNd_o8RcJ51BI40l6BuZK3xrBe2O3tYrHGIS8tWrfBeyVVfZljGPdcnW6A2w6k7LIK6P-q_wvNhdhpmU9j-FXZGMJvCzkn49Qi2p_DiAs-_VT4Ns9Owe5HnfP_iRwAAAP__RCHy6Q==

# Test that we can handle merge joins with equality columns of integers with
# different widths.
Expand Down
8 changes: 3 additions & 5 deletions pkg/sql/logictest/testdata/logic_test/vectorize_local
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,10 @@ SET tracing = on; SELECT * FROM tpar WHERE a = 0 OR a = 10; SET tracing = off
# Note that table ID here is hardcoded, so if a new table is created before
# tpar, this query will need an adjustment.
query T
SELECT message FROM [SHOW TRACE FOR SESSION] WHERE message IN
('querying next range at /Table/56/1/0',
'querying next range at /Table/56/1/10')
SELECT message FROM [SHOW TRACE FOR SESSION] WHERE message LIKE 'querying next range at %'
----
querying next range at /Table/56/1/0
querying next range at /Table/56/1/10
querying next range at /Table/56/1/0/0
querying next range at /Table/56/1/10/0

# Regression test for #46123 (rowexec.TableReader not implementing
# execinfra.OpNode interface).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ WHERE message LIKE '%r$rangeid: sending batch%'
----
dist sender send r37: sending batch 1 DelRng to (n1,s1):1
dist sender send r37: sending batch 2 CPut to (n1,s1):1
dist sender send r37: sending batch 2 Scan to (n1,s1):1
dist sender send r37: sending batch 2 Get to (n1,s1):1
dist sender send r37: sending batch 1 EndTxn to (n1,s1):1

query B
Expand Down Expand Up @@ -717,7 +717,7 @@ WHERE message LIKE '%r$rangeid: sending batch%'
AND operation NOT LIKE '%async%'
----
dist sender send r37: sending batch 1 DelRng to (n1,s1):1
dist sender send r37: sending batch 1 Scan to (n1,s1):1
dist sender send r37: sending batch 1 Get to (n1,s1):1
dist sender send r37: sending batch 1 Del to (n1,s1):1
dist sender send r37: sending batch 1 Scan to (n1,s1):1
dist sender send r37: sending batch 1 EndTxn to (n1,s1):1
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ vectorized: true
│ ordering: +pid1
│ estimated row count: 4 (missing stats)
│ table: parent1@primary
│ spans: /1-/1/# /11-/11/# /21-/21/# /31-/31/#
│ spans: /1/0- /11/0- /21/0- /31/0-
│ parallel
└── • scan
Expand Down Expand Up @@ -486,7 +486,7 @@ vectorized: true
table: child2@primary
spans: [/1 - /1] [/11 - /11] [/21 - /21] [/31 - /31]
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJycklFv0zAQx9_5FKfbSwtGqV22h0hIARYgU9eMpAgQyoOJjzZSZgfbkUBVvzuKM2lk6oDt7Xx3_7vf_-Q9uh8txph-vlq9ytYwO8_KTflhNYcyXaVvNvAU3hb5JXTSkvYcLvJsDfWuaZWAj2W2fgezrlF8Dp_ep0UKQwzDGM6AcwaCM1jyOeTFeVrA6y-hARlqo2gtr8lh_BU5Vgw7a2pyztghtQ8NmfqJ8YJho7veD-mKYW0sYbxH3_iWMMaN_NZSQVKRjRbIUJGXTRvG3iAnnW2upf2FDMtOahdDxJ9HPDoBqRUswfgdWYfVgaHp_e0m5-WWMOYH9jgaPqUZb3YMJjqJTs9umIZI_B-YuBfslqfXxiqypCYs1aD8V8sRd5dkt3RhGk02ElN3LX33s4Q_m7-0zXY3hsgw730MCWeJYMkLlpyy5OxeP8uHHLog1xnt6K6vo5MXgxlSWxqP40xva7qypg5rxmcedCGhyPmxKsZHpkMp_IQ_xfwBYnFXLP4qXk7Ei0N1ePI7AAD__9aLKbQ=
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJycklFvlEAQx9_9FJPx5U63gd2zfSAxQS0qDYUK16gxPKzseEdCd3F3STSX--4G0NRrrmp9IbMz85_5_Sfs0H3tMMLkw1X2Is1hcZ5W6-pdtoQqyZJXa3gCr8viEnppSXsOF0WaQ7NtOyXgukrzN7DoW8WX8P5tUiYwxjCO4Qw4ZyA4gxVfQlGeJyW8_Dg1IENtFOXyhhxGn5BjzbC3piHnjB1Tu6khVd8wChm2uh_8mK4ZNsYSRjv0re8II1zLzx2VJBXZIESGirxsu2nsT-S4t-2NtN-RYdVL7SIIeBCejJ8gv84ykFrBCozfknVY7xmawd8udF5uCCO-Z_8HxQ-h5tMdZXocnJ4F_ORXJP4NTNwLdsszaGMVWVIHLPWo_FvLEXeXZDd0YVpNNhCH7jr64hcxf7p8btvNdg6RYTH4CGLOYsHiZyw-ZfHZvX5WDzl0Sa432tFdX0cnh6MZUhuaj-PMYBu6sqaZ1szPYtJNCUXOz1UxP1I9laY_4Xcxf4BY3BWLP4pXB-JwX-8f_QgAAP__02Qrig==

# Parent-grandchild.
# We add the pa1 > 0 condition so a lookup join is not considered to be a better plan.
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ SELECT info FROM [EXPLAIN (VERBOSE) SELECT * FROM p2@p2_id WHERE i >= 1 AND d IS
query T
SELECT info FROM [EXPLAIN (VERBOSE) SELECT * FROM bytes_t WHERE a = 'a'] WHERE info LIKE '%spans%'
----
spans: /"a"-/"a"/#
spans: /"a"/0-

# No tightening.

Expand All @@ -262,7 +262,7 @@ SELECT info FROM [EXPLAIN (VERBOSE) SELECT * FROM bytes_t WHERE a < 'aa'] WHERE
query T
SELECT info FROM [EXPLAIN (VERBOSE) SELECT * FROM decimal_t WHERE a = 1.00] WHERE info LIKE '%spans%'
----
spans: /1-/1/#
spans: /1/0-

# No tightening.

Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/exec/execbuilder/testdata/interleaved
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ SELECT info FROM [
EXPLAIN (VERBOSE) SELECT * FROM level4 WHERE k1 = 2 AND k2 = 20 AND k3 = 200
] WHERE info LIKE '%spans%'
----
spans: /2/#/54/1/#/55/1/20/200/#/56/1-/2/#/54/1/#/55/1/20/200/#/56/1/#
spans: /2/#/54/1/#/55/1/20/200/#/56/1/0-

# ------------------------------------------------------------------------------
# Trace of interleaved fetches from interesting interleaved hierarchy.
Expand Down
Loading

0 comments on commit 2cd87ed

Please sign in to comment.