Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: low estimated RUs are rounded to zero #100617

Closed
DrewKimball opened this issue Apr 4, 2023 · 0 comments · Fixed by #111986
Closed

sql: low estimated RUs are rounded to zero #100617

DrewKimball opened this issue Apr 4, 2023 · 0 comments · Fixed by #111986
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. docs-done docs-known-limitation E-quick-win Likely to be a quick win for someone experienced. T-sql-queries SQL Queries Team
Projects

Comments

@DrewKimball
Copy link
Collaborator

DrewKimball commented Apr 4, 2023

The RU estimate surfaced in EXPLAIN ANALYZE is displayed as an integer value, and is propagated as one in several places. Because of this, the estimate is zero for fractional RU estimates, e.g. for very cheap queries. This is unexpected and confusing to users. We should store and display RU estimates as float values instead.

Example in cockroach demo:

demo@127.0.0.1:26257/movr> EXPLAIN ANALYZE SELECT * FROM rides LIMIT 1;
                     info
----------------------------------------------
  planning time: 432µs
  execution time: 388µs
  distribution: full
  vectorized: true
  rows read from KV: 1 (179 B, 1 gRPC calls)
  cumulative time spent in KV: 245µs
  maximum memory usage: 20 KiB
  network usage: 0 B (0 messages)
  sql cpu time: 20µs
  estimated RUs consumed: 0

  • scan
    nodes: n1
    actual row count: 1
    KV time: 245µs
    KV contention time: 0µs
    KV rows read: 1
    KV bytes read: 179 B
    KV gRPC calls: 1
    estimated max memory allocated: 20 KiB
    sql cpu time: 20µs
    missing stats
    table: rides@rides_pkey
    spans: LIMITED SCAN
    limit: 1
(25 rows)

Time: 1ms total (execution 1ms / network 0ms)

Jira issue: CRDB-26523

@DrewKimball DrewKimball added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Apr 4, 2023
@DrewKimball DrewKimball added this to Triage in SQL Queries via automation Apr 4, 2023
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Apr 4, 2023
@DrewKimball DrewKimball moved this from Triage to 23.2 Release in SQL Queries Apr 4, 2023
@mgartner mgartner added the E-quick-win Likely to be a quick win for someone experienced. label Aug 3, 2023
craig bot pushed a commit that referenced this issue Nov 4, 2023
111986: sql: change type for RU estimates from integer to floating-point r=DrewKimball a=highpon

This patch changes the display for RU estimates shown in `EXPLAIN ANALYZE` from
integer to float. This will prevent small estimates from being rounded to zero, which
makes the estimate less confusing for cheap queries.

Fixes #100617

Release note(sql change): Currently, RUs are showing integer number.
RUs have the potensial to be floating number, however they are now rounded.
From now on, RUs are showing floating number, so they are not rounded.

Co-authored-by: HighPon <s.shiraki.business@gmail.com>
@craig craig bot closed this as completed in 29ce256 Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. docs-done docs-known-limitation E-quick-win Likely to be a quick win for someone experienced. T-sql-queries SQL Queries Team
Projects
Archived in project
SQL Queries
23.2 Release
Development

Successfully merging a pull request may close this issue.

4 participants