From 805b682483ff6c333b1d2db4bf6d52684cbdc40d Mon Sep 17 00:00:00 2001 From: Uzair Ahmad Date: Tue, 21 May 2024 09:47:08 -0400 Subject: [PATCH] sql: add a default AOST option to CREATE STATISTICS Using CREATE STATISTICS without an AOST option results in a regular scan which could contend with concurrent transactions. This commit adds a default AOST option of -1us to the CREATE STATISTICS command to avoid this. Fixes: #72719 Release note (sql change): using the CREATE STATISTICS command without the AS OF SYSTEM TIME option could contend with concurrent transactions and cost performance. Running CREATE STATISTICS without specifying AS OF SYSTEM TIME now uses a default of -1us. --- .../testdata/logic_test/distsql_event_log | 2 +- .../exec/execbuilder/testdata/distsql_misc | 20 +++++++++---------- pkg/sql/opt/optbuilder/misc_statements.go | 7 +++++++ .../opt/optbuilder/testdata/misc_statements | 20 ++++++++++++++++++- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_event_log b/pkg/sql/logictest/testdata/logic_test/distsql_event_log index 3ddce7e07aa2..b8320c3ed6d4 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_event_log +++ b/pkg/sql/logictest/testdata/logic_test/distsql_event_log @@ -31,7 +31,7 @@ FROM system.eventlog WHERE "eventType" = 'create_statistics' AND ("info"::JSONB ->> 'DescriptorID')::INT = 106 ORDER BY "timestamp", info ---- -1 {"EventType": "create_statistics", "Statement": "CREATE STATISTICS s1 ON id FROM test.public.a", "TableName": "test.public.a", "Tag": "CREATE STATISTICS", "User": "root"} +1 {"EventType": "create_statistics", "Statement": "CREATE STATISTICS s1 ON id FROM test.public.a WITH OPTIONS AS OF SYSTEM TIME '-1us'", "TableName": "test.public.a", "Tag": "CREATE STATISTICS", "User": "root"} statement ok DROP TABLE a diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc index 0384a71c0e15..259308afdf3a 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc @@ -92,7 +92,7 @@ vectorized: false · • create statistics · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lVtvmzAUx9_3Kazz1EpGYCA3PzVqOwmptwUeJk1R5YbTFJVgZht1XZXvPjlZ1sIKSpDCAwIDv_Pz3xfeQP_MgcPl97uraXRDTi6iOIm_XZ2S89nlNLkkcTJNojiJzmOiGbm9IYJ8nd1ek1QYARQKmeKNWKEG_gMYUPCBQgAUQqAwgDmFUskFai2VfeVt80GU_gLuUciKsjK2eU5hIRUCfwOTmRyBQyIecpyhSFG5HlBI0Ygs35Sxpc_s6b58xlegcC7zalVoTqxRXAp76biMiCIljEjzhArmawqyMu8FtRFLBM4-GEYXwL013V8yFqsyR-UO6oLb5jj7jZwwz_Osf2yE4eSMtYr4DZFBq8h7_aqQKkWFaa3-fN2qOl0uFS6Fkcpl3v7S5MT3PPJQLZ7R6NPWLgSNLrB6mGz_EWc9Rtxljuv3GnN2iOZuzIdHGPNhTcTfPy-_T16-4wa98vIP0dzlNTpCXqOaSLB_XkGfvALHDXvlFRyiuctrfIS8xjWRcP-8wj55hY476JVXeIjmLq_JEfKaHPIzmKEuZaGxsRd_XslrVHKY3bQxXeJ2h9eyUgu8U3KxeXd7e7sBbRpS1Gb7lG1vomL3SBuFYvXvX_aRxDpJfo3EPpIGTZLf7XSIVNCJCttJrEkK-3Zv2CQNOknDdie_SRr2dRo1SaNO0rjdKWiSxn2dxk3SpHsaeO1S4X9zs3uad1hN7NJ5zOXLfZYCB-_v4Xxy2h1gPxBLbddv_CRfNtjktbSr71HkGilci2e8QINqlRWZNtkCuFEVrtdf_gQAAP__uYub4w== +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lV1ro0oYx-_Ppxiem7YwoqPmzauGNuUITdKTEc4uSyjT-DSVGic7M9Ltlnz3xWSzrW6VRIgXoqP-nt_858U30N9TCGD05e52GE7I-XXII_7f7QW5mo2G0YjwaBiFPAqvONGMTCdEkJvZdExiYQT5P4z-JdO7KJxOOBlyMr0h_CuPRmMSheMRObNYrs-AQiZjnIgVagi-AQMKLlDwgIIPFDowp7BWcoFaS1W88rb9IIx_QOBQSLJ1bormOYWFVAjBG5jEpAgBROIhxRmKGJXtAIUYjUjSbZlC8LI43a-f8RUoXMk0X2U6IAIo8LUoLi2bEZHFhBFpnlDBfENB5ua9oDZiiRCwD4bhNQTOhh4uycVqnaKyO2XBXTNPfmJAmOM4hT83wgTkktWKuBWRTq3Ie_08kypGhXGp_nxTqzpcLhUuhZHKZs7h0uTcdRzykC-e0eiL2i54lS6wcpjs8BFnLUbcZpbtthpzdozmfsy7JxjzbknEPTwvt01ermV7rfJyj9Hc59U7QV69koh3eF5em7w8y_Zb5eUdo7nPq3-CvPolEf_wvPw2efmW3WmVl3-M5j6vwQnyGhzzM5ihXstMY2Uv_rySU6lksWLTxniJux1ey1wt8E7Jxfbd3e10C9o2xKjN7inb3YTZ_pE2CsXqz7_sI4k1ktwSiX0kdaokt9npGCmvEeXXk1iV5LftXrdK6jSSuvVObpXUbevUq5J6jaR-vZNXJfXbOvWrpEHzNHDqpfy_5mbzNG-wGhRL5zGVL_dJDAE4vw_rk9P-gOIDsdTF-uVP8mWLjV7Xxep7FKlGCmPxjNdoUK2SLNEmWUBgVI6bzT-_AgAA___I8qX8 statement ok INSERT INTO data SELECT a, b, c::FLOAT, 1 @@ -115,7 +115,7 @@ quality of service: regular · • create statistics · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsls9u2zgQxu_7FMScWkCOREr-p1OzbhcwijSFZfSyMApGmqqCZVFLUnCygR9rX2CfbCEpWluK5FpGDOQQHwyTHM98H-dHgo-g_orBhdni0_XyE_GW18u5t5zPPKIouf1COPljcXtDAq45GJCIAL_wDSpw_wQKBjAwwAYDHDBgCCsDUil8VErIPOSx-MM8uAfXMiBK0kzn0ysDfCER3EfQkY4RXFjyuxgXyAOUpgUGBKh5FBdl8tIf8q_v6RofwICZiLNNolySK_JSnv8cmJT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0SQmJfQxFHcpLUjEpGwHLYzJiCStypQCX5dfH_IVPaCFE5kW60z7INDCIBflz4HNQGQxMJDmEym08N17MMmafHD-_UfX40hmhjKTyOyrJSXvNcQUyZhiH5jj1NN3D4Y0KBKxD2PHgV_r6eXiZgKRSFO9E5uLRG1jeTU5ez-ZgDaUQySLzMBL-mzsJDOvfHDspwCiVVdAJUsWJi9MXel2Y2E9_rKR2ogloc92dn76Bn1nYx2_-YFY5ykpe9jc-Ho6SP6mqnZlKTDC-PCadQrhLSHDTiFP9YtMqpgUxY36t5tOqZfLpaKlMFLZzDleNLzkjgN3RbQio191WnBbFlhzM9nxJLNnkGyzgc2_I8t8H8vsbATvkj008300e6egmfegmfVpwJbm0QloHjWE8ONJ4M8hgQ9s9ycJjQbwPg3YknB-AhLOG0Lc40lwn0OCO7C9nyQ0GuD2acCWhPEJSBg3hHjHk-A9hwRvYA-_IwnuPhL4mbufBHcfCaNTkOD2IMHr04AtCRcnIOGiz6NrQTqXmabWm2d_JadVacDKxxHFS6pfUloWKqIbJaMqth7Oq0TVREza1KusHkyz7ZI2isT6_zfjbiZ2MBNvZGK7mYbtTPywpj6i3IOpvO5MrJ3J62tPVF3BjMy9VKv6JGnKqourfOptF-qzVK883arb1TVpLZZPASXpuzpHbZ3DgzpH3Y55O9Pox3R83tZ5flDnuNux2840_jEdj9s6Lw4fEKfbsvfVqT18AfTy7HZ65mfeNzwPW54vyivrYyrvPyQx-uh8-Qz2fG0_WP5BLHV5bwaf5H0lOnzIy1vvo0g1WTgTK3pDhtQ6yRJtkgh9owrabH75LwAA___QJWcs query T retry EXPLAIN (DISTSQL, TYPES) SELECT * FROM data @@ -155,7 +155,7 @@ quality of service: regular · • create statistics · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsV1GPmzgQfr9fYc1Tq3MWbEg266fspT0pqratkqgvp6jywjRFIZizjbZ7q_ys-wP3y05AaYANaeiqVSM1DwjPDOP5Zr7PgQcwf8cgYDp_eb18SRbL6-VssZ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jnuBux0840_jERj9t1nh0WiN0N2X2k2sMHQC_MTidmfuJ-AfOwhfmsOLI-JPLufRyBB_bn32DPZfuD4gGx1MW56X-Ud2XRwX1WnHofRKKRwpVY4Ws0qNZxGmsTh-AZleNm879_AwAA__8k7Tpb query T EXPLAIN ANALYZE (DISTSQL) CREATE STATISTICS s1 ON c, e, a FROM data @@ -174,7 +174,7 @@ quality of service: regular · • create statistics · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsl9Fu2zYUhu_3FMS52jC6EinZcXjlzO0Ao0hS2EZvBqNgxFNXiExqJI00C_xYe4E92SApbm1VMiyjDnpRXQjgIfXzPzwfBfIJ3N8ZCBhP31zN35DZ_Go-mc0n4xlxjNzekIQSpESSP6e310RJL4GCNgpv5AodiL-AAQUOFCKgEAOFPiwo5NYk6JyxxZCn8oOJ-gwipJDqfO2L8IJCYiyCeAKf-gxBwFzeZThFqdAGIVBQ6GWaldMUU4-K14f8Hh-Bwthk65V2gkhamLwDCrNcFoFewIjUijBi_Ce0QGGKWqEVZMQoGXFKRtHvTAgxuZkPgcLb98SnKxQk_O9fV7UToz1qnxr9TZc1D44oTIxCJQgLwyp89-jREYtSCTIMQ_JHFV5O341JIrPM7YzNZWq3Y3kZvH4_HhPnMSeJWWtPfsXPPki1_02QMPg6APG-bUBpy6x9vvbVTIsNhar9vNjOyyWCYDvVmbwGEW7o8QWayVWeoQ36-8WpwrP0n2KlikJ46cvVHnE6ilqt8JqVfquVrw7W2liFFtWeg8Wm1ezVcmlxKb2xAQu_i-2oZpvtLyE7nnF2MuMB6wX8xSjnTZSzVwPyNm3gnDdxHp-Dc96Bc9alSFvOB2fhfLBnhR_PCz-dF94Lop-8dOCFdynSlpeLs_BysWclOp6X6HReol4Q_-SlAy9RlyJteRmehZfhnpX4eF7i03mJe0H_xXiJmnjhr6JmXqImXgbn4CXqwEvcpUhbXi7PwstllyPgFF1utMPa-at5prA2U48VBzVUS6xOdc6sbYLvrEnKsVXzthQqAwqdr3p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MVvwUvQpkhrXs5Pwst5myPglEyhckON89fumdzGTB1eHtQomVN9qjNqqWO61iquxtbNSSVUBRIytu7ldWOUr7uM1SQXX06wm0r8oJK3pcQ3lbpNJe-wpzam_INSwX4l3lQK2qYnq6pgTvZO6dt6LxnKy4tCeZt7DNd7qY73q_vLumdBxsj5l04XZ5v-ek1_3YP-evsz9ZpKvR8r07Omv7OD_vr7M_WbSv0fK9N-09_54Y3g7k81-GZ3Ht7oz57reflL-pipuw9pggLdx6ez47V-sPxAzk35Xww_qbvKbHRflH-1jzIzxHAsb-kNWdKLNE-NTWMUVi9ptfrp_wAAAP__8PmLNQ== query T EXPLAIN ANALYZE (DISTSQL) CREATE STATISTICS s1 ON e FROM data @@ -193,7 +193,7 @@ quality of service: regular · • create statistics · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsltFu2zYUhu_3FMS5ajE6EinZcXjVzO0Ao0hS2EZvhqBgxFNXsExqJIU0C_xYe4E92SCpWmzV8iwDBnpRXwgmeXTO_-t8JPgM7s8MBExm764X78h8cb2YzhfTyZw4Ru5uCZLfZ3c3REkvgYI2Cm_lGh2IP4ABBQ4UIqAQA4Uh3FPIrUnQOWPLkOfqhan6CiKkkOq88OX0PYXEWATxDD71GYKAhXzIcIZSoQ1CoKDQyzSrypSl35SPT_kKn4DCxGTFWjtBHoDCPJfl30HAiNSKMGL8F7RAYYZaoRXkDfuVCSGmt4sxUHj_kfh0jYKE__zt6nFitEftU6O_W7Lm0RGFiVGoBGFhWE8_PHl0xKJUgozDkPxWTy9nHyYkkVnmtmJzmdomlleTNx8nE-I85iQxhfbkFX71Qar9a0HC4CUAcdUVUMkyhc8LX1e631Cox98-r_NyiSDYVj-mb0GEG3p8S-ZynWdog-FuO-rpefoXVrUrS3MvffmlO4XwlpBhp5CX-oU2VqFFtVP_ftMp9Xq5tLiU3tiAhceLJq94GJKHIlmhd687LUQtC2z3Y7Lj-WYn8B2wQcDPTjjfRzi7GJH36R7G-T7G43Mwznswzvq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FcZ79W-3nVIvVyuFK2GksqlzumjymjkOuSuiNRr9ptOC27JA9z8mPZ1v-gy-bTqy2eCEs0OE07MJ-ZAcYJwdYtwbgnHWg3Hapy0N45MBGJ_sCWGn88Gewwcb2e4LHyfwwfq0peHjfAA-zveEuKfz4T6HD3dkey98nMCH26ctDR_TAfiY7gnxTufDew4f3sgeD86He4gPduYe5sM9xMdkCD7cHnx4fdrS8HExAB8XfS5zS9S5zDS27lKHKzmtSiNaXrowXmF9Q9OyUBHeKBlVsfVwUSWqJmLUpl6l9cDPmiVtFIrNf3fR3Uz0aCa2l4nuZhq3M7HjmvqIco-m8roz0XYmr689UXUFMjT3Uq3rnaQxq46z8grZLNR7qV55Omub1Q1qLVZPASXpuzonbZ3jozon3Y5ZO9Pkx3R83tZ5flTntNux2840_TEdT9s6L45vEKfbsvfdrj1-APTy7HZ6Zmfe_3getzxflEfW51Tef0pi4OB8-40OPJoflC-IlS7PzeCLvK9Ehw95eep9FqlGC-Zije_QoNokWaJNEgE3qsDt9qd_AwAA__-rbIQd statement ok ALTER TABLE data ADD COLUMN f FLOAT AS (atan2d(c, d::float)) VIRTUAL @@ -215,7 +215,7 @@ quality of service: regular · • create statistics · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsl9Fu2zYUhu_3FMS5ajG6EinZUXjlzG0Bo0tS2EZvBqNgxBNXiExqJI00C_xYe4E92SApbm3VNix3XnsRXQjg4dHP_-h8FKhHcH_mIGAwenMxeUPGk4vJcDwZDsbEMXJ9RW4pQUoUeTu6viRKegkUtFF4JefoQPwBDChwoBABhRgodGFKobAmReeMLVMeqweG6jOIkEKmi4Uvw1MKqbEI4hF85nMEARN5k-MIpUIbhEBBoZdZXi1TLt0vbx-LO3wACgOTL-baCaIouaEkBQrjQpaBTsCI1IowYvwntEBhhFqhFaTPKOnzX5kQYng1SSiRXmquXvQj2mdCvP39-mKSvAQK7z4Qn81RkPCfv109To32qH1m9DdT1tw7ojA1CpUgLAzr8M2DR0csSiVI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H0gjwwnlCWkBPc6g5_2fCyGGV1GXgbQy95KXPZ_1uBCXv4z7UfcVMnz7Dmw6JwHu33-Zehyr3FJuU5V_MaXVvYGEYpVQIoC7bh2-ebBkQJNMBHRdF36qw7PJ9QBimWVmLbeQqV7lelVw9G4wAGOpgFgtcgsv6aN10ty-EuA6nxOI7nYlVLbUwhYLW680XTKsx0_v31g5IxR8rWHDNyjcJTu8Z6GcFxlpp73Zrzocpn-Wb6rsjZW2akDPYz1_pxWvYaW908pnB4tc6YQ0JRsOpsudZvuzmaaZtEo73P1XbPsN23zzFfLDsefPxt7hLcf7luB728DnrzvwNt2CvrcN_eAU6HtHoM-P6dsK_c5J0O9sWPEOR8h7PkJey_F_IPR1CHnH9G2F0NlJEDrbsOIfjpD_fIT8lhP8QOjrEPKP6dsKoe5JEOpuWAkORyh4PkJBy2l_S4T8bQh5r_3tCPnbEOqcAiH_CISCY_q2Quj8JAidH3OcnJApVG6ocZbbvpLbWKnFy0MfJTOqT4hGLXRM11rFVW49HFdCVSAhY-tZXg-G-WrKWE1y_uk0vK7E9yp5G0p8XandVPL2ezrGlL9XKtitxJtKwbHlyaormJO9V_qu3kuG8vKno_xZfArXe6mOd6t_odXMnIyRs0-TLk7X_XWa_tp7_XV2V-o1lTrfV6VnTX9ne_11d1fqN5W631el3aa_8_0bwd1davDF7ty_0f_zWs_LT9Jtpu7fpwkKdJ-u1pbb6sLyATkz5Xcx_KDuK7PRQ1F-1W5lZojhSN7RG7Kk52meGpvGKKxe0HL5v38CAAD__8Sapbw= statement ok CREATE TYPE gh AS (g INT, h INT) @@ -246,7 +246,7 @@ quality of service: regular · • create statistics · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsV8Fu2zgQve9XEHNKsHQkUrLj8OSs2wJGN01hG70sgoIRp65gWdSSNNJs4M_aH9gvW0iqa0mxXAtpgQSoD4I4MxrOm3l8Bh_A_p2AgPH09eX8NZnNL-eT2XwynhHLyJvp9RVR0kmgkGqF7-QKLYi_gA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4lGiPnmwDXh-tqnYNmnf2ddQ7aEfNmpsHLRHzcrPN4Z53DdsReM9PwZSIeNus82X1A3HbI_pNTu1sAOmH2WjHzI_8rmPsNzCe5ZH1cqLsPSQwC3C-_3pbH-gf5B3Juct0MPqm7oujwfpWr3ke5MEjhQt7iW7Sol0maGJtEIKzO8PHxp_8CAAD__196bXc= # Check that we also collect stats on the hidden expression index virt column. statement ok @@ -269,7 +269,7 @@ quality of service: regular · • create statistics · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsWM1u2zgQvu9TEHNKdulIpOSf8OSs2wJGN01hG70sgoIRp64QWdSSNNJs4MfaF9gnW0iq15JiuRbSAkFQHQRyZjScj_PxM-gHsH8lIGAye32xeE3mi4vFdL6YTubEMvJmdnVJlHQSKKRa4Tu5QgviT2BAgQOFACiEQKEP1xQyoyO0Vps85KH4YKq-gPApxGm2drn5mkKkDYJ4ABe7BEHAQt4kOEOp0Hg-UFDoZJwUy-RLj_PXx-wW74HCRCfrVWoFkZTcUBJRooDCPJO5recxIlNFGNHuMxqgMMNUoRFkzCgZc0rGASXjMB__xoQQ03eLESVj9mvuk06mXJ2MAzoOhXjzx9XFYnQKFN5-IC5eoSD-v__Ych7p1GHqYp0-chl9Z4nCSCtUgjDfL8039w4tMSiVICPfJ7-X5uXs_YREMklsJTaTsdnG8sJ4-WEyIdZhRiK9Th05wS_Oi1N3Kojv7QIQb9sCirL02mVrV650vaFQzr92xTq5RBCs0sbpKxD-hh7fyblcZQkar1_vYmmex39jsXYBae6ky_uyG_KKlVZnQd1Bq4bwkY9Wbf3dcLAbDlvR8wb6fiv6Heh1qo1Cg6oG-nrTuj8Xy6XBpXTaeMw_fqfICfd9crOObtHZ08q-tTkau3gorL6n34is73Bb8KDNMSQnfGdu60TQ6ASrE5EdLynsKZLisZ7Hn5mo8H2iws4G5G28R1b4PlkJf4Ss8A6ywrp0cysrg5ciK4Maen48l_mTuMx7XvCTy9-dy7xLN7dcHr4ULg9r6IPjuRw8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Tb1t0Me5thvxE9r6HvNqLfgM5SpWPUGFdA36wa9-dsNtM4k1Zph7mH7xQ54q5LbrPoDq053tq3JkdtF_eFVff0K5HVHW4K7jU5-uSIb8xNnfBqnWBVIrLDJYU9R1Ic1nH4CxMVvktU2EmPvEt2yArfJSv-95AV3kJWWJturmWl91pkpVdBzw_nMn8Wl3nH8X5w-Ztzmbfp5prL_dfC5X4FvXc4l71ncdnrOP4PLn9zLntturnm8uC1cHlQQe8fzmX_WVz2O073hXHZ28VlfuLt5rK3i8u978FlrwWX_TbdXHP59LVw-bTNxW2KZqlSg7UrzO6V3NpKHZbfdTCeYXkxMirTEV5rFRWx5XRSJCoMMRpbelk5Gadrl7Ea5eK_e-d2JrY3E69kYtuZuvVMfH9NbYry9qbymzOxeia_LTxZdAVStPdK35XH12Ca631xq1w7ygNcejY_RmvvAo2Rs02AW_yRs6mzV6-zu7fOXjNiXs_Ue5mI-_U6-3vrHDQj9uqZBi8T8aBe5-n-A-I2Q_afnNr9AtAKs9eImZ_4X8HcrWE-zSXr41zdf0hiEOB-eTo7XusH8g_kzOS6GXxS90XR4cMyV72Pcm6QwqW8w7doUS-SNDE2iUBYneFq9b9_AwAA__9Jx4la # Check that we also collect stats on other hidden columns. statement ok @@ -295,7 +295,7 @@ quality of service: regular · • create statistics · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsWM1u2zgQvu9TEHNKdulIpOSf8OSs2wJGN01hG70sgoIRp64QWdSSNNJs4MfaF9gnW0iq15JiuRbSAkFQHQRyZjScj_PxM-gHsH8lIGAye32xeE3mi4vFdL6YTubEMvJmdnVJlHQSKKRa4Tu5QgviT2BAgQOFACiEQKEP1xQyoyO0Vps85KH4YKq-gPApxGm2drn5mkKkDYJ4ABe7BEHAQt4kOEOp0Hg-UFDoZJwUy-RLj_PXx-wW74HCRCfrVWoFkZTcUBJRooDCPJO5recxIlNFGNHuMxqgMMNUoRFkzCgZc0rGASXjMB__xoQQ03eLESVj9mvuk06mXJ2MAz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2iUBYneFq9b9_AwAA__9Jx4la # Check that we can disable stats collection on virtual computed columns. statement ok @@ -321,7 +321,7 @@ quality of service: regular · • create statistics · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsV8Fu2zgQve9XEHNqAToSKdlxdErW7QJGkW1hG70sjIIRp65gWdSSFNJs4M_aH9gvW0iqakmxVAtpgRqoD0I4MxrOm3mPYh7B_B1DALPF65vVa7Jc3azmy9V8tiSGkT8Wb2-JFFYAhURJ_FPs0EDwFzCgwIGCBxR8oDCGNYVUqxCNUToPeSxemMvPELgUoiTNbG5eUwiVRggewUY2RghgJe5iXKCQqB0XKEi0IoqLbfKtr_PHh3SLD0BhpuJsl5iACEruKAkpkUBhmYrcNnIYEYkkjCj7CTVQePOe2GiHAXH_-9eU61AlFhMbqeSJS6t7QySGSqIMCHPd0nz3YNEQjUIGZOq65PfSvFm8m5FQxLGpxaYi0lUsL4y372czYiymJFRZYskL_GydKLEvA-I6hwDEbVdAUZbKbJrZcqf1nkK5_tJRY8UGIWC1EcxfQeDu6elTWIpdGqN2xs0JlOZl9A8WexeQllbYgFyzw5-8ZqX1ldd00LrBf-Kj134nON4CN-4Ed8CUJUpL1CgbmNb7Tvg3m43GjbBKO8w9vRHkBXddcpeFW7TmZa0tXY5Wk_rCmi37RmRfA71WA1mTHux0kbLniNRhI4d_R5nyYzJlFxPyJjoiVH5MqP6PECofIFQ2ZBKVUCdnItRJAxw_nWb8WTTjI8f7RbPGJPiQSVQ0uzwTml02wHmn08x7Fs28keP_olljEt6QSVQ0m54JzaYNcP7pNPOfRTN_5Iy_I828YzTjF95xmnnHaDb5ETTzBtDMHzKJimZXZ0KzqyFX9wWaVCUGW7fc4zu5rZ1GLL8Oo9xgeXc2KtMhvtMqLGLL5dsiUWGQaGzpZeVinlQuYzWK3df_POqZWG8m3sjE6pnG7Uy8v6YhRXm9qfzuTKydyR8KTxRTgQTtvdLbUp0Gk-Kkzb-4laPUZ-k5fAYq7w6NEZtDgOvBul7npF3n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6zBGK6zuzlrmKsQbJcMytlrOy0SlIUJtKi-rFtN059JGodj8_5_HYSbWmYnXMrHDTMNmJt5dU5-inM5Ubnsm1szk9oUnyqlAiuZOqnWlTo1pedIWX9ydo9Jn5dl_BnbeDWotVvsA24HlYZ2jZp3DzjpH7Yh5M9Pox0R83qzzvLPOcTtip5lp_GMiHjfrvOgWiN0O2X2k2u4DoBdmpxUzP3O_gnnYwHxRHFkfE3n3IY7AA_vLb3DksftB8YJY6eLc9D_Ju7Lo4D4rTr2PItFIYSbW-BoNqk2cxtrEIXhG5bjd_vJfAAAA___kNfk_ statement ok RESET CLUSTER SETTING sql.stats.virtual_computed_columns.enabled diff --git a/pkg/sql/opt/optbuilder/misc_statements.go b/pkg/sql/opt/optbuilder/misc_statements.go index fb05ab36d218..830b31c719fe 100644 --- a/pkg/sql/opt/optbuilder/misc_statements.go +++ b/pkg/sql/opt/optbuilder/misc_statements.go @@ -148,6 +148,13 @@ func (b *Builder) buildControlSchedules( func (b *Builder) buildCreateStatistics(n *tree.CreateStats, inScope *scope) (outScope *scope) { outScope = inScope.push() + + // We add AS OF SYSTEM TIME '-1us' to trigger use of inconsistent + // scans if left unspecified. This prevents GC TTL errors. + if n.Options.AsOf.Expr == nil { + n.Options.AsOf.Expr = tree.NewStrVal("-1us") + } + outScope.expr = b.factory.ConstructCreateStatistics(&memo.CreateStatisticsPrivate{ Syntax: n, }) diff --git a/pkg/sql/opt/optbuilder/testdata/misc_statements b/pkg/sql/opt/optbuilder/testdata/misc_statements index c704597932b2..b5bd713ec4b8 100644 --- a/pkg/sql/opt/optbuilder/testdata/misc_statements +++ b/pkg/sql/opt/optbuilder/testdata/misc_statements @@ -183,7 +183,25 @@ build CREATE STATISTICS foo FROM ab ---- create-statistics - └── CREATE STATISTICS foo FROM ab + └── CREATE STATISTICS foo FROM ab WITH OPTIONS AS OF SYSTEM TIME '-1us' + +build +CREATE STATISTICS foo FROM ab AS OF SYSTEM TIME '-2s' +---- +create-statistics + └── CREATE STATISTICS foo FROM ab WITH OPTIONS AS OF SYSTEM TIME '-2s' + +build +CREATE STATISTICS foo FROM ab THROTTLING 0.3 +---- +create-statistics + └── CREATE STATISTICS foo FROM ab WITH OPTIONS THROTTLING 0.3 AS OF SYSTEM TIME '-1us' + +build +CREATE STATISTICS foo FROM ab THROTTLING 0.3 AS OF SYSTEM TIME '-2s' +---- +create-statistics + └── CREATE STATISTICS foo FROM ab WITH OPTIONS THROTTLING 0.3 AS OF SYSTEM TIME '-2s' build ANALYZE ab