sql: reduce allocs in execStmtInOpenState [~5% allocs] #135908
Labels
branch-master
Failures and bugs on the master branch.
C-performance
Perf of queries or internals. Solution not expected to change functional behavior.
o-perf-efficiency
Related to performance efficiency
P-1
Issues/test failures with a fix SLA of 1 month
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
T-sql-queries
SQL Queries Team
Under sysbench oltp_read_only this shows up very prominently, as one of the top hitters in
peek
:I'm not actually sure which one is right (does this function allocate 2031648 times or 5072675 times which is 2.5x of the former?) but it's clear that it allocates all over the place. Summing up the "Total:" lines in the listing1 gives 5807416 which is yet another number, but it's close to the latter. So, we think this is around 2.5*1.28% or around 5%! Much of that seems avoidable at first glance and someone should spend some quality time with this code.
Even its three return parameters leak to the heap (because they are named and get passed to all kinds of functions inside of execStmtInOpenState). You can see this here alongside all the other allocations.
I was so confused by this that I used
scripts/goescape
which also told me that thectx
arg gets moved to the heap:presumably because
ctx
is leaked into theportal
here.Epic: CRDB-42584
Jira issue: CRDB-44787
Footnotes
$ grep 'Total' src.txt | awk '{ print $2 }' | grep -E '[0-9]+' | perl -lne '$x += $_; END { print $x; }' 5807416
↩The text was updated successfully, but these errors were encountered: