From 95d269b0cb653014aa8652f421b6ceedb98b1e24 Mon Sep 17 00:00:00 2001 From: Tommy Reilly Date: Fri, 23 Apr 2021 11:52:58 -0400 Subject: [PATCH] sql: add 'max sql temp disk usage' stat to explain analyze output Disk usage is currently tracked per node but we don't report it. Having to look at the sql.disk.distsql.spilled.bytes.written metric or examine explain analyze (distsql) diagram is cumbersome. Example: > explain analyze (distsql) SELECT ... planning time: 2ms execution time: 18.6s distribution: full vectorized: true rows read from KV: 6,001,215 (806 MiB) cumulative time spent in KV: 10.8s maximum memory usage: 32 MiB network usage: 0 B (0 messages) max sql temp disk usage: 170 MiB Add a unit test to confirm output is as expected and doesn't appear in non-spill situations. Also this field is completely omitted in redact situations as whether we spill is a metamorphic random variable so spilling isn't deterministic. Release note (sql): Add line to explain analyze output to show disk spill usage to make it clear when disk spilling occurs executing a query. This output is only shown when the disk usage is greater than zero. The verbiage in the distsql explain diagrams changed from 'max scratch disk allocated' to 'max sql temp disk usage' for consistency and to match how we talk about sql spill disk usage elsewhere. --- pkg/sql/execinfrapb/component_stats.go | 2 +- pkg/sql/execinfrapb/component_stats_test.go | 8 +-- pkg/sql/instrumentation.go | 1 + .../testdata/logic_test/dist_vectorize | 2 +- .../testdata/logic_test/explain_analyze_plans | 8 +-- .../logic_test/inverted_index_geospatial | 6 +-- .../testdata/logic_test/vectorize_local | 2 +- pkg/sql/opt/exec/explain/BUILD.bazel | 7 +++ pkg/sql/opt/exec/explain/main_test.go | 24 +++++++++ pkg/sql/opt/exec/explain/output.go | 13 +++++ pkg/sql/opt/exec/explain/output_test.go | 53 +++++++++++++++++++ 11 files changed, 112 insertions(+), 14 deletions(-) create mode 100644 pkg/sql/opt/exec/explain/main_test.go diff --git a/pkg/sql/execinfrapb/component_stats.go b/pkg/sql/execinfrapb/component_stats.go index 6ba31ca796b3..9f072473783f 100644 --- a/pkg/sql/execinfrapb/component_stats.go +++ b/pkg/sql/execinfrapb/component_stats.go @@ -157,7 +157,7 @@ func (s *ComponentStats) formatStats(fn func(suffix string, value interface{})) fn("max memory allocated", humanize.IBytes(s.Exec.MaxAllocatedMem.Value())) } if s.Exec.MaxAllocatedDisk.HasValue() { - fn("max scratch disk allocated", humanize.IBytes(s.Exec.MaxAllocatedDisk.Value())) + fn("max sql temp disk usage:", humanize.IBytes(s.Exec.MaxAllocatedDisk.Value())) } // Output stats. diff --git a/pkg/sql/execinfrapb/component_stats_test.go b/pkg/sql/execinfrapb/component_stats_test.go index bf8c615760bd..8959e5017305 100644 --- a/pkg/sql/execinfrapb/component_stats_test.go +++ b/pkg/sql/execinfrapb/component_stats_test.go @@ -80,7 +80,7 @@ KV bytes read: 80 B`, expected: ` execution time: 0µs max memory allocated: 0 B -max scratch disk allocated: 0 B`, +max sql temp disk usage:: 0 B`, }, { // 5 stats: ComponentStats{ @@ -185,7 +185,7 @@ KV rows read: 10 KV bytes read: 12 KiB execution time: 1s max memory allocated: 1.0 KiB -max scratch disk allocated: 1.0 KiB +max sql temp disk usage:: 1.0 KiB batches output: 10 rows output: 100`, }, @@ -237,7 +237,7 @@ KV rows read: 10 KV bytes read: 12 KiB execution time: 1s max memory allocated: 1.0 KiB -max scratch disk allocated: 1.0 KiB +max sql temp disk usage:: 1.0 KiB batches output: 10 rows output: 100`, }, @@ -305,7 +305,7 @@ KV rows read: 10 KV bytes read: 12 KiB execution time: 1s max memory allocated: 1.0 KiB -max scratch disk allocated: 1.0 KiB +max sql temp disk usage:: 1.0 KiB batches output: 10 rows output: 100`, }, diff --git a/pkg/sql/instrumentation.go b/pkg/sql/instrumentation.go index 591b2a6a1857..42b348149bd8 100644 --- a/pkg/sql/instrumentation.go +++ b/pkg/sql/instrumentation.go @@ -431,6 +431,7 @@ func (ih *instrumentationHelper) buildExplainAnalyzePlan( ob.AddMaxMemUsage(queryStats.MaxMemUsage) ob.AddNetworkStats(queryStats.NetworkMessages, queryStats.NetworkBytesSent) + ob.AddMaxDiskUsage(queryStats.MaxDiskUsage) if err := emitExplain(ob, ih.evalCtx, ih.codec, ih.explainPlan); err != nil { ob.AddTopLevelField("error emitting plan", fmt.Sprint(err)) diff --git a/pkg/sql/logictest/testdata/logic_test/dist_vectorize b/pkg/sql/logictest/testdata/logic_test/dist_vectorize index cad8c9dd548c..4c048501b89b 100644 --- a/pkg/sql/logictest/testdata/logic_test/dist_vectorize +++ b/pkg/sql/logictest/testdata/logic_test/dist_vectorize @@ -110,7 +110,7 @@ network usage: table: kw@primary spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsmt1u2zYUx-_3FMS52la5MiU7TQQUMDZ0QLo1HtJiN4MvGOnMFmyLHknH8YI81l5gTzbImtv6Q5_IQsr0XSSKls6P_3P0F3MeQf45gwA-vvvl3Y-fyPfkp9vhBzK9J--H1zdkuiLDGzK9fz0lb8l09XoKDiQ8whs2RwnB70DBAQ8c8MGBHjjQh5EDC8FDlJKL9JLHzYTr6AGCrgNxsliq9PTIgZALhOARVKxmCAF8YnczvEUWoXC74ECEisWzzW2m94OFiOdMrMGBjwuWyIB03PTGP_9GVDzHgHT_-VtmxyFPFCYq5snBkOArSQSyKCA0O3O3Vrg9dUl-AAfumAonKAlfqsVSBSR9lM287QkKoycHsqMswm0Ed2syYXKy--yD9PqRA1KxMUJAn5xmSC72kKwOkbi0pVC8XChffoeLCAVG-7_zKr1xpauO8P2AYozveZygcOme5mb4h_p2QF9991bE40n2JzgwTKMdUGfgOQPfGaSixwcMl4do5-yBzHHOxZqw2YyHTGEUkO6GZzomQ5FSJVEsp4dX1Cb-haZfgeYyOUbqKKQb3uELl_Z38eQEXfrY_dzH7u08Nq2eGbS8WLhex_XbmBm0KZQ3FcpFW6F4uVBesFzQ0ywXXnWJeRXyzu-4vTZKjDaFclkh79oKxcuF8oJ5551m3vnVJeZXyLtex-23UWK0KZSrCnnXViheLpQXzDv_NPOuV11ivQp51--0UWC0KZJ-edZ1XEpYEhFKuJqgaCMeLxfPC-Zf7zTzr2QH5BblgicS9z5Tj_9yN4WI0RizpZF8KUL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7nVeZDeu9asDfN-hGONbHqcoXLqjuQT_Ut8P6IsfXot4PMn_BAeG2WoH1Bl4zsB3Bpno8QHDxT7aGXsgM5xxsSIsSXjIFEYB6a55ZmPyY0IUzuYkiuWULCQbY7AZb8z7M0u_BstFeojTQUQ3vMPnLu1vwylYcmXY_cKwe1th0_p5QatLhet1XL-NeUGPhfKqRrFoKxSvEMozFgt6isXCqy8wr0bW-R2310aB0WOhXNbIurZC8QqhPGPWeaeYdX59gfk1sq7XcfttFBg9FspVjaxrKxSvEMozZp1_ilnXqy-wXo2s63faKC96LJJ-dc51XEpYGhFKuJqgaCMerxDPM2Zf7xSzr2Lf4xblnKcSdz5PD1-5myHEaIz5g5F8IUL8XfBwfZv8cLiet_5aiFCqfNTLD67TzZBUTJV93n5TdN1cMfXDvygMP0W15GJKEqYwDVef4t-cX7JYba8sQokiZkn8N9tf9mba_xkZYny_XvcXQ5vU_DS2XvNmdIYyY7E7-esjudKMhJYgufwqSGhTJLRY5dbKhPZtZEIbFEPPvGJYHv5FYfjWPtErzUi0FMNyJLRY5dbKZKcYWsLE22XS_ZKJv_1-2J3sl06m27Woa14p7R1pi09YD-VIiq12K56oblts4BO10xZXMNFti7U4hv6RtviEZVKOpNhqG1IMy8PXbYsNfKJ22uIKJrptsZZieNHEFtuB5NXZLDdDYuW-dDmSYgNuyCuzPHztZtnAxNdulrXI_PJslpshsXJfuhxJsQE3pBiWh6_dLGsphhVMdJtlLTK_OpvlvX81HNtxccIyqWCi2y6bqBMrN6wrmJSYcEPem1ULsNIx02PbLuxlotsz66mIZjdzmKiTEiduSkU8t14cgNKo98KS7N9rKTHKN5vIRLdv1pM75Uzs9M3lTLRvXhsJpdiLm_LqbNKkZotHbNKlZoubaNL6dmZixA62kVCKvbgpFXGvYcVC3zx6-u6_AAAA___AK3SS # Verify execution. statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans b/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans index 364465e875d1..fe3d3990a0f8 100644 --- a/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans +++ b/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans @@ -99,7 +99,7 @@ network usage: table: kw@primary spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsm29vmzgcx5_fq7D8qNPIiE3SpZEmZZt2p-7WZOqfk6ZTVLngS1ESyBmnaa_qy7o3cK_sBGnWBIINrKsB8yxgHPh9_PXX8Y9f7mHw9wz24dmnL58-noPpzZupAcjN5GC6ejN9BX49HZ2A6Q34PDoegukKjIbRJeAdCNvBb6eji6_gw7foJDSg5zt0SOY0gP0_IYIGxNCAFjRgBxqwC8cGXDDfpkHgs_CS-6jDsXML-20Dut5iycPTYwPaPqOwfw-5y2cU9uE5uZrRU0ocysw2NKBDOXFn0W2mN4MFc-eE3UEDni2IF_RBywxvPFryPhiEj_H7H4C7c9oH7f_-DdbHtu9x6nHX9xJNzF8FgFHi9MFj56s7TjeneuADNOAV4fY1DYC_5IvwNuFDRf02JxAcPxhwfbSOdRPL1R24JsH1bhSD8PqxAQNOJhT20YNRDM5hDM4qCcdElceDU_E8fY_PHMqoE_-e1-GNM121h_QJZRP62Xc9ykwU0-GM_sUPBuj1q3fMnVyvPz5RNgYhcnpL7WUS6pzcgjmd--wOkNnMtwmnTh-0I5JhW2CzkCdw3GCavCI36yeOVh6ZvZ9MGJ0Q7jMTdRPDY8DRGuWjpt4Pv10OR-eXw4svXw4GKERxdnFyMMDhp4-ji-H54-cUJj9ZQZ0fU5AYD27_GJ6zi5PL4xCQFR6dUs-hLBIRGGBzYD0jtCcg3QxAlt4-JHtpDP2WvzBxTCdFH7ub-tiHO4-Nshslkq8iJm6ZVrWNEhXF8zbDOlJ9PDgVzwuuI6hu64hEZtvryGG91pHcCpKsI6jq6wjO7jg4gyFbLbNTbcdBRfH0Mhhy9fHgVDwvaMi4boYskdm2Ib-tlyHnVpDEkHHVDdnK7jhWBkPutMxutR0HFcVzlMGQq48Hp-J5QUO26mbIEpltG3KvXoacW0ESQ7aqbsid7I7TyWDI3Va1_QYVhdOV23HLRIB4DkDA59eUVRsUTgX1gsbcqZsxSwS3bcxH9TLm3AqSGHOn6sYseRtySoOF7wU0lgrf_83tkBZ1JnRNN_CXzKZfmW9Ht1kfjqJ-UQ7JoQFft-L1wbG3aQo44aJU-k-eR-21dWQPoJcagEf5ymdTMCOcevbd9wg251fE5buxOTSgzCUz9x-SDHzT7dGabereRHFtNW08-ntbFPOmdU6DgExovPPzI0GWYiZIwKT3LExQbiaNTpJzX7VOlDBBOfwQl9EPxQH0UgPQdkxjfvjyTJT4oYRJoxOZH2rCBMeZtLeZ7CJpxztbQqCdkv243DNLxAGgto4rpIRJt2GScI5GJ0kmWuqkI3TTGJJ4566wMz7c9WLldron_MOCyYYaK0KMJH1bWpExVZ5sKOGg6plskMx91TpRsgl7WzDZUGOZiJGkb0tL44fiAJQnG0o4qHomGyRzX7VOlPhhT_gL90icbDgqmGyoscbESATpi9IkYCQRaLmJFDPRM9kgYaKlTlDi_Z4o26DHCoPyvN_TRSd5Xhk2TCRpjdJsRGQhqB7XUs5_1WkINWJPvORr8hASJlpuWSVMBLmN8piiJATV46rGFCXzX3UuQo3YE-8vd349o444G4ESr_qadISEiZ7lFDIo6du00iRpJCHomZGQQVG9_VYDRVzDoJqJmtW3qYrIy0TPrWtTaZEfSgUKaGTzX89xbUoj8jLRc-valFvkh1KBKhrZ_NdzXMX1EUhSIIGaCokk0sIlEhpDUb1NKyMUQZKjPHmapkpizx_cmiqJJJNyV0mUkYnqlISauVO4SkJjKI1SciU5SrMlweWuklBjik2VRF4meqYkZFAapeRKcpTHFMVVElhSJYGbKokk0qZKIj8U1du0MkLRs-5CBqUC9TS4qZIYP4wffvk_AAD__w-cClQ= +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsm39v2rgfx___PgrLf3VaWLADHY00iW3a99TdClN_nDSdUOUSH42AhDmmtFf1Yd0TuEd2SigrEGInrKudOP81cUzsl99-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jwQ5ipkgAZPOszBBhZnUOknPfNU6UcIEFXBDrJ8bipvfyWy-sSO65YYvz0SJG0qY1DqRuaEhTPA2k-Y6k00kze3KjhBoS6sPyx1zRNx81DRxdZQwaddMUr5R6yTNxEidtIReuoVku3JbWBkfbjqxft-lh3sGGSqsBzGS7A1pKUZUeZBBwyE1M8ggmfmqdaJk-_V2zyBDhWUiRpK9IdXEDcXNVx5k0HBIzQwySGa-ap0occOO8Nv2SBxkONozyFBhjYmRCAIXmgReJO03cvMoZmJmkEHCxEidoNSZnijKYMb6goqc6ZmikyIHhTUTSUhDk02IrAOqR1XL2a86AKFG6qmDvToCIWFi5HZVwkQQ19DFEiUdUD2qaixRMvtVRyHUSD11Zrnx5Yxa4jgESh3v1YEICRMzUyhkULK3aJqEZyQdMDMWIYOieuOtBoo4a0E1EzVrb50JUZSJmdvWOr-iOBTtk2Zks9_MUa3TIYoyMXPbWidZFIeifeaMbPabOarinAgkSYpAdVZEGuneaREGQ1G9RdMRiiDAoUuEps6M2PGvbHVmRJqJ3pkROjJRHYxQM3f2zowwGEqtlEIBDk22I1jvzAg1llhnRhRlYmYwQgalVkqhAIculijOjMCSzAhcZ0akkdaZEcWhqN6i6QjFzGwLGRTtc2hwnRkxeBg8_O-_AAAA__8KQ_L5 # This query verifies stats collection for the hashJoiner, distinct and sorter. query T @@ -147,7 +147,7 @@ network usage: table: kw@primary spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsnN9uo0YUxu_7FKO52lXx4hmw4yCtFO2fqtm2cZVElarKFwSmMbINLozjpFEeqy_QJ6vAyzp4zBxItplZxneL8cSc3zlzvuEb2Huc_TXHHr74-PPH95fow-nF5enZ-0v0arZ-s36Nfjgf_4JmN-jT-PQMzdZofIZmN29m6C3Kz6Px-YeP5-jd78URtnCchOzMX7AMe39ggi1MsYUdbGEXW3iAJxZepknAsixJ86_cFwNOw1vs9S0cxcsVzz-eWDhIUoa9e8wjPmfYw5f-1ZydMz9kqd3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LaoVBSDY-le1vSl2-ridwCr_coOpxlABOJ8aGJcQNNQPWuQceommlTQFCM9CmIYIRXSyoFSqrcMx6auGUngB9mZJrJmZi59AB_vd4X0eROBkp01SaGlqvfzP2IYIcfbAyAiZlPb8iZSMwRXUoikOiqnQw1JRGAotrKUJPq8kM-MgQ23sIx38HLAJiY-RAHBKV-P6KLwSOfgKFeBgDFzBsq4QCxWlJHQEkVHPeDl0EEx_3gZQBMVC89HfPEzGc8oMWj19nKEyZgpJdB27xCZ8jNDMBEtZehpCQCTMx80ANaPPX-iCYlEZqAkV4GlR8iUuAQkQqHiAcvA2BippcBQTFzPyKHIvFHNDF4oAmovqFSE1XhGLFaUl2gpMrfPzHSy6CC466Vl6EjEzOXnpyJmV4GtHjM3I8AUPQ6W9k3AeAYwcj7djkT1V6GmkQHDhHN9DKAxaP6WQ8todT7I7qURPkhIgUOEan8tR0zvQzglTcz9w4AFDO9DOClNyOf9YCg6PX-_74dlfy1PQd4bc8RLHcDvYzJw__-DQAA__8Zn8kG # This query verifies stats collection for WITH ORDINALITY and the hashJoiner. query T @@ -191,7 +191,7 @@ network usage: table: kv@primary spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUUc1u00AQvvMUozmiRYn_OOzJBYpqKDVKIhBCPmy8o3YVe9fsrkuiKI_FC_BkyDYVTdKkBMSB43yz3873s0b3pUKO0_PL85czeAqvJ_k7WNzCx2x2AfnkVXZ1dpnNPsHZFAQ7sJgjQ20kXYmaHPLPGGDBsLGmJOeM7aB1_yCTS-Rjhko3re_ggmFpLCFfo1e-IuQ4E_OKJiQk2dEYGUryQlX9t4vbtLGqFnaFDKeN0I7DM2T49gN4VROH8fdvbphLoz1pr4zeW1nz1YElITkkAzJfebqD4jG8QIZz4csbcmBa37SeQ6ekJ94BCRYbhsP004nz4pqQBxv2-25zK5UWlfKrUbBtlpZUtvsG_kJYeIqw-zWE_2MN0R_WEP3rGuKDwn7pabWxkizJLTFFx3zsyQPuLoS7eWOUJjuKt93lndQ0YGnI0oilMUsTlj5Hdsh2LZZQU23sCkRVmVJ4khyGrrqdK20XDEjlFvsvHg0tPJxackqdE3KN0Y5203vw53EXGclrGipwprUlvbem7M8MY97zekCS88M2GIZMD6tO4H1ycJQcb5GDXXJ4lBwdvxydcDncJcdHycnO5WLz5EcAAAD__yk3D0s= +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUUcFu00AQvfMVozmiRYkdm8OeXKCohlKjJAIh5MPGO0pXsXfd3XVJFOWz-AG-DNkmokmblIA49Djv7dt5b94a3U2JHCfnl-evp_Ac3o6zD7C4hc_p9AKy8Zv06uwynX6BswkIdoCYIUNtJF2JihzyrxhgzrC2piDnjG2hdfcglUvkQ4ZK141v4ZxhYSwhX6NXviTkOBWzksYkJNnBEBlK8kKV3beL26S2qhJ2hQwntdCOwwtk-P4TeFURh-GP766fC6M9aa-MvkdZ882BJSE5xD0yW3naQtEQXiHDmfDFNTkwja8bz6F10gm3QIz5hmE__UrivJgT8mDD_jxtZqXSolR-NQh2w9KSiuZ-gH8wFp5i7G4N4VOsYfSXNYz-dw3RQWO__TTaWEmW5I6ZvFU-9uSBdBfCXb8zSpMdRLvpstZqErAkZMmIJRFLYpa8RHYodiWWUFFl7ApEWZpCeJIc-q5azt2U4KmqQSq3gMaJOfEt_-jJwsM3i08pc0yuNtrR_u0e_HnYHozknPoCnGlsQR-tKbo1_Zh1ug6Q5HzPBv2Q6p5qDd4VB0fF0Y442BeHR8Wj45tHJ2wO98XRUXG8tznfPPsZAAD__zX-Di8= # Verify that EXPLAIN ANALYZE on an unsupported query doesn't return an error. statement ok @@ -239,7 +239,7 @@ network usage: table: kv@primary spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzslU1u2zwQhvffKYhZJQAN_X8ouEpbpEXQHxdOkC4KLxhx4BKWSJWk7LiGj9UL9GSFKMut7KRWlwa8nBm-Hr7PjKk12G8FMLi9fn_9-o7wxexifknG99cTcnFJ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h9OyR9IiaU2K8KLQufcoWAk9ESamr0viMOyIkLaOaktnyHr6geJZS8Si3vEouFPJTr8VIJ4FCTH8lji4dbjAdaTUZAei_VkuPVkgPV05P8vR2E9HW49HWA9Gx2L8QMfhQnaSiuLOzvy-V8Om92JYobtorW6Njl-MTr3bdpw7HU-IdC6thq1wZXyJX_Bp-Lor-L_e-JwVxz_S2dvxbsChW6pzZwU3KHKV9sBdfkll64_OoEWjeSF_MH359rJNsPNUS5wM-Cu1E25q7WT7qol2mbXPz0QDn4IfSTJCckukvSEZBdJdkKynq7_-x0AAP__cwfZzQ== # Very simple query to make it easier to spot regressions when rewriting results # in test files. diff --git a/pkg/sql/logictest/testdata/logic_test/inverted_index_geospatial b/pkg/sql/logictest/testdata/logic_test/inverted_index_geospatial index da1a3116fbc6..91c6e0655824 100644 --- a/pkg/sql/logictest/testdata/logic_test/inverted_index_geospatial +++ b/pkg/sql/logictest/testdata/logic_test/inverted_index_geospatial @@ -68,7 +68,7 @@ network usage: table: geo_table@geom_index spans: 31 spans · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMleFO20gQx7_fU4zmC6DzKbu2yYU9nZQDzDVtIciJWqE6Qos9BQtnN93dtEYoj9UX6JNVtoESopim7Yfmw0Yzs__NzG9mN7doPxQocBS9jg7GcA1H8fAYLkmfO3lRELx9EcURWHeeK0fGUurs9tYoHhz-63f3eO-f0-HgZLwdMsZYAPUXC3a2hPg_Gh5H4_jMq86a7sAwPoxi2D-Da_RQ6YxO5JQsinfIceLhzOiUrNWmct3WGwZZiYJ5mKvZ3FXuiYepNoTiFl3uCkKB4yrHmGRGpsPQw4yczIv62IcS-lUC57nKqEQPRzOprIBOgvtJUr7PkqTkLElK9tyCf22q4QmCVBkEDLS7ImPRw1dvwOVTEsC-fL6zU60cKZdrtRIy-pMFQzITEDaeixtH967Ah3308EK69Ios6LmbzZ2AikMtvHeEOFl42Fh3HK2Tl4SCL7zvZz1QH8k4yo7ywpEh0-HLwO_jUTkzo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_wbOF-BdQ83ah9jzW3jqz1i9eX4GMM15fdi5z-_0j9vJ30v-FD3zeGgM24APfD3y-J17eikP3YOtgdpL_-pj8XTBNlLake_46pCH__ps7M4e7lBWSKVVhaK2sbTuz5cxBSubUfqyMWuiYLrWKm9e05rjRNY6EjG2jvDVGRRuqE3wp5p1it1vsdoq9brHXKfa7xX6n-PCVeLb87kMAAAD__7ojt7Q= statement ok DROP TABLE geo_table @@ -144,7 +144,7 @@ network usage: table: geo_table@geom_index spans: 31 spans · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMleFu2zYQx7_vKQ73JQmmwaSkeA6HAV4SZfO2xIFstAgqI2CkayJEJl2Sbh0Efqy-QJ-soJSkcYyoNdIC1QcKd8c_dfc7krpF-65CgaPk_-RgDNdwlA6P4ZL0uZMXFcHrf5I0AevOS-XIWMqd3d4apYPDP8PuHu_9cTocnIy3Y8YYi6B-sWhnS4i_k-FxMk7PAr_WdAeG6WGSwv4ZXGOAShd0IqdkUbxBjpMAZ0bnZK023nVbTxgUCxQswFLN5s67JwHm2hCKW3SlqwgFjn2OKcmCTIdhgAU5WVb1sg8l9H0C56UqaIEBjmZSWQGdDPezbPG2yLIFi_zAvjLgb5tqeIYgVQERA-2uyFgM8L9X4MopCWCfPt7ZuVaOlCu1WgsZ_cGCIVkICBvPxY2jexfvwj4GeCFdfkUW9NzN5k6A51AL7x0hTpYBNtYdR-vkJaHgy-DbWQ_UezKOiqOycmTIdPgq8Pt4spgZ0Ar6XID1tME6aZyo6UW_72YZ8_SYh9Q6IJAqNpV56GvUhx5D3-dbF1hzbZA2tnWyqlbp04Ly-XpTpnIBU5pqcwOyqnQuHRUCWN0IH7O58e2AorTX6zNe0Kpwk1b9q0t1dyrC507FzJRTaW6-0An64SaAfsBOfob5C6hFm1B72NjRKrPGL55egowz7q-7kIXd7h57_Bx0_-K9mDdGj_V4L46TmG-Jx_diP9z5rlvzBZjiTTCNtHFkOvEqpD7_9Sc8NbubFJaSnWllaaWw51Zmy0mAVFxS88Oyem5yOjU6rz_TmMNaVzsKsq6J8sYYqCbkE3ws5q3isF0ctoqjdnHUKo7bxXGrePeJeLL85XMAAAD__9deue4= +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMleFO40YQx7_3KUbzBVBdZdc2adiqUgqYNm0hyIlaoTpCiz0NFrbX7G7aIJTHuhe4JzutTTgCwncRd9Llw0bzH__XO7_ZXd-juS1Q4CT6Mzqawg2cxONTmJO6tPKqIPj7tyiOwNjLvLKkDaXW7O5M4tHxz37_gA9-Oh-Pzqa7IWOMBdD8sWBvR4hfo_FpNI0vPDdXuQfj-DiK4fACbtDDSmV0JksyKP5BjjMPa61SMkZpJ903D4yyJQrmYV7VC-vkmYep0oTiHm1uC0KBU7fGmGRGusfQw4yszItm2scShm4Bl3mV0RI9nNSyMgJ6CR4myfLfLEmWLHAD-8SAP2zr4QmCrDIIGCh7Tdqgh3_8BTYvSQB7_-4hTlVlqbK5ql6ktPrfgCaZCfBb5erO0lrifThED6-kTa_JgFrYemEFOA6NcS34OFt52EYPHI2Vc0LBV97nsx5V_5G2lJ3khSVNusc3ga_z0bLWoCoYcgHG0QZjpbaioRf8uJ8kzNFjDlLngEBVtq3NQX9BfewwDN16mwIbri3SNjZWFsUmfVpSunjZlFIuoaRS6TuQRaFSaSkTwJpGuJy5LcBSWUOWmxtYGDknsc6_oVH-No36XeXVw5nwXzsTtc5Lqe8-svGG_jZ4vsI-foX4G6gF21B73NbBJrNWF8-vQMYZd5edz_x-_4A9_R31f-GDkLfBgA34IAyjkO-Ip7fi0N_7ohvzDZjCbTBNlLake-EmpCH__ps7M_vblBWTqVVlaKOs12Zmq5mHlM2p_VgZtdApnWuVNq9pw3Hja4SMjG2zvA1GVZtyC3xq5p1mv9vsd5qDbnPQaQ67zWGnef-Zebb67kMAAAD__8r8t7Y= # Also works when creating an index. statement ok @@ -196,4 +196,4 @@ network usage: table: geo_table@geom_index spans: 31 spans · -Diagram: https://cockroachdb.github.io/distsql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pzqa7IWOMBdD8sWBvR4hfo_FpNI0vPDdXuQfj-DiK4fACbtDDSmV0JksyKP5BjjMPa61SMkZpJ903D4yyJQrmYV7VC-vkmYep0oTiHm1uC0KBU7fGmGRGusfQw4yszItm2scShm4Bl3mV0RI9nNSyMgJ6CR4myfLfLEmWLHAD-8SAP2zr4QmCrDIIGCh7Tdqgh3_8BTYvSQB7_-4hTlVlqbK5ql6ktPrfgCaZCfBb5erO0lrifThED6-kTa_JgFrYemEFOA6NcS34OFt52EYPHI2Vc0LBV97nsx5V_5G2lJ3khSVNusc3ga_z0bLWoCoYcgHG0QZjpbaioRf8uJ8kzNFjDlLngEBVtq3NQX9BfewwDN16mwIbri3SNjZWFsUmfVpSunjZlFIuoaRS6TuQRaFSaSkTwJpGuJy5LcBSWUOWmxtYGDknsc6_oVH-No36XeXVw5nwXzsTtc5Lqe8-svGG_jZ4vsI-foX4G6gF21B73NbBJrNWF8-vQMYZd5edz_x-_4A9_R31f-GDkLfBgA34IAyjkO-Ip7fi0N_7ohvzDZjCbTBNlLake-EmpCH__ps7M_vblBWTqVVlaKOs12Zmq5mHlM2p_VgZtdApnWuVNq9pw3Hja4SMjG2zvA1GVZtyC3xq5p1mv9vsd5qDbnPQaQ67zWGnef-Zebb67kMAAAD__8r8t7Y= diff --git a/pkg/sql/logictest/testdata/logic_test/vectorize_local b/pkg/sql/logictest/testdata/logic_test/vectorize_local index 73591b106c5c..b21b3b934ecf 100644 --- a/pkg/sql/logictest/testdata/logic_test/vectorize_local +++ b/pkg/sql/logictest/testdata/logic_test/vectorize_local @@ -168,7 +168,7 @@ network usage: table: d@primary spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMk8GO0zwQx-_fU4zm9KE12zpdcbC0UgQKqAtNULrignJw7aEbkdjBdkSrqo_FC_BkKAkrNm1ZqLjsLfOf-dvzm3F26L9UKHCZvEte3YK6lPA6zxagYJ6mSQ6LJH-TwE02T0FDlvYF16AvV8jQWE2prMmj-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BHh-bpo-bLg7bz3bOfAQAA__88a9nr statement ok RESET vectorize; RESET distsql diff --git a/pkg/sql/opt/exec/explain/BUILD.bazel b/pkg/sql/opt/exec/explain/BUILD.bazel index 933f5144770f..4665e79c9f1d 100644 --- a/pkg/sql/opt/exec/explain/BUILD.bazel +++ b/pkg/sql/opt/exec/explain/BUILD.bazel @@ -40,19 +40,26 @@ go_test( size = "small", srcs = [ "explain_factory_test.go", + "main_test.go", "output_test.go", ], data = glob(["testdata/**"]), embed = [":explain"], deps = [ + "//pkg/base", + "//pkg/server", "//pkg/sql/catalog/colinfo", + "//pkg/sql/execinfra", "//pkg/sql/opt/exec", "//pkg/sql/sem/tree", "//pkg/sql/types", + "//pkg/testutils/serverutils", + "//pkg/testutils/testcluster", "//pkg/util", "//pkg/util/encoding", "//pkg/util/treeprinter", "@com_github_cockroachdb_datadriven//:datadriven", + "@com_github_stretchr_testify//assert", "@com_github_stretchr_testify//require", "@in_gopkg_yaml_v2//:yaml_v2", ], diff --git a/pkg/sql/opt/exec/explain/main_test.go b/pkg/sql/opt/exec/explain/main_test.go new file mode 100644 index 000000000000..9f85eaac495b --- /dev/null +++ b/pkg/sql/opt/exec/explain/main_test.go @@ -0,0 +1,24 @@ +// Copyright 2021 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package explain_test + +import ( + "os" + "testing" + + "github.com/cockroachdb/cockroach/pkg/server" + "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" +) + +func TestMain(m *testing.M) { + serverutils.InitTestServerFactory(server.TestServerFactory) + os.Exit(m.Run()) +} diff --git a/pkg/sql/opt/exec/explain/output.go b/pkg/sql/opt/exec/explain/output.go index f2296cb691c5..a423d1b7812d 100644 --- a/pkg/sql/opt/exec/explain/output.go +++ b/pkg/sql/opt/exec/explain/output.go @@ -396,3 +396,16 @@ func (ob *OutputBuilder) AddNetworkStats(messages, bytes int64) { fmt.Sprintf("%s (%s messages)", humanizeutil.IBytes(bytes), humanizeutil.Count(uint64(messages))), ) } + +// AddMaxDiskUsage adds a top-level field for the sql temporary disk space used +// by the query. If we're redacting leave this out to keep logic test output +// independent of disk spilling. Disk spilling is controlled by a metamorphic +// constant so it may or may not occur randomly so it makes sense to omit this +// information entirely if we're redacting. Since disk spilling is rare we only +// include this field is bytes is greater than zero. +func (ob *OutputBuilder) AddMaxDiskUsage(bytes int64) { + if !ob.flags.Redact.Has(RedactVolatile) && bytes > 0 { + ob.AddTopLevelField("max sql temp disk usage:", + humanizeutil.IBytes(bytes)) + } +} diff --git a/pkg/sql/opt/exec/explain/output_test.go b/pkg/sql/opt/exec/explain/output_test.go index 1766b38baaa6..773434d9224e 100644 --- a/pkg/sql/opt/exec/explain/output_test.go +++ b/pkg/sql/opt/exec/explain/output_test.go @@ -12,17 +12,26 @@ package explain_test import ( "bytes" + "context" "fmt" + "regexp" + "strings" "testing" "text/tabwriter" + "github.com/cockroachdb/cockroach/pkg/base" + "github.com/cockroachdb/cockroach/pkg/server" "github.com/cockroachdb/cockroach/pkg/sql/catalog/colinfo" + "github.com/cockroachdb/cockroach/pkg/sql/execinfra" "github.com/cockroachdb/cockroach/pkg/sql/opt/exec/explain" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/types" + "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" + "github.com/cockroachdb/cockroach/pkg/testutils/testcluster" "github.com/cockroachdb/cockroach/pkg/util" "github.com/cockroachdb/cockroach/pkg/util/encoding" "github.com/cockroachdb/datadriven" + "github.com/stretchr/testify/assert" yaml "gopkg.in/yaml.v2" ) @@ -122,3 +131,47 @@ func TestEmptyOutputBuilder(t *testing.T) { t.Errorf("expected no rows, got %v", rows) } } + +func TestMaxDiskSpillUsage(t *testing.T) { + testClusterArgs := base.TestClusterArgs{ + ReplicationMode: base.ReplicationAuto, + } + distSQLKnobs := &execinfra.TestingKnobs{} + distSQLKnobs.ForceDiskSpill = true + testClusterArgs.ServerArgs.Knobs.DistSQL = distSQLKnobs + testClusterArgs.ServerArgs.Insecure = true + serverutils.InitTestServerFactory(server.TestServerFactory) + tc := testcluster.StartTestCluster(t, 1, testClusterArgs) + ctx := context.Background() + defer tc.Stopper().Stop(ctx) + + conn := tc.Conns[0] + + _, err := conn.ExecContext(ctx, ` +CREATE TABLE t (a PRIMARY KEY, b) AS SELECT i, i FROM generate_series(1, 10) AS g(i) +`) + assert.NoError(t, err) + maxDiskUsageRE := regexp.MustCompile(`max sql temp disk usage:: (\d+)`) + + queryMatchRE := func(query string, re *regexp.Regexp) bool { + rows, err := conn.QueryContext(ctx, query) + assert.NoError(t, err) + for rows.Next() { + var res string + assert.NoError(t, rows.Scan(&res)) + var sb strings.Builder + sb.WriteString(res) + sb.WriteByte('\n') + if matches := re.FindStringSubmatch(res); len(matches) > 0 { + return true + } + } + return false + } + + // We are expecting disk spilling to show up because we enabled ForceDiskSpill + // knob above. + assert.True(t, queryMatchRE(`EXPLAIN ANALYZE (VERBOSE, DISTSQL) select * from t join t AS x on t.b=x.a`, maxDiskUsageRE), "didn't find max sql temp disk usage: in explain") + assert.False(t, queryMatchRE(`EXPLAIN ANALYZE (VERBOSE, DISTSQL) select * from t `, maxDiskUsageRE), "found unexpected max sql temp disk usage: in explain") + +}